/* =============================================================================
   SENTINO AI - ACADEMIC RESEARCH PAGE
   Luxury editorial aesthetic · Answer-first results · Perplexity-inspired
   ============================================================================= */

/* =============================================================================
   1. BASE LAYOUT
   ============================================================================= */

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.app-container::before {
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  width: 50%;
  height: 60%;
  background: radial-gradient(ellipse at top right, rgba(249, 115, 22, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.main-content {
  flex: 1;
  max-width: none;
  margin: 0;
  padding: 0;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* =============================================================================
   2. SEARCH SECTION
   ============================================================================= */

.search-section {
  margin-bottom: 2rem;
}
.search-section.has-results {
  margin-bottom: 0;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.search-section.has-results .search-hero {
  display: none;
}
.search-section.has-results .search-form {
  max-width: 600px;
  margin: 0;
}
.search-section.has-results .search-meta {
  max-width: 600px;
}

.search-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.search-hero h2 {
  font-family: var(--font-serif, var(--font-display));
  font-size: var(--text-4xl, 2.5rem);
  font-weight: 400;
  color: var(--fg);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.search-subtitle {
  color: var(--fg-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 720px;
  margin: 0 auto;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 100px;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  gap: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 32px rgba(0, 0, 0, 0.04);
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.06), 0 8px 32px rgba(249, 115, 22, 0.08);
}

.search-bar-icon {
  color: var(--fg-faint);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.search-bar:focus-within .search-bar-icon {
  color: var(--accent);
}

.search-input {
  flex: 1;
  padding: 0.75rem 0;
  border: none;
  font-size: 1.05rem;
  font-family: var(--font-sans);
  background: transparent;
  color: var(--fg);
  outline: none;
}

.search-input::placeholder {
  color: var(--fg-faint);
}

.search-btn {
  padding: 0.75rem 1.75rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 100px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.search-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.search-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.search-btn.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
}

.search-meta__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filters-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.filters-toggle:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.history-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-full);
  transition: all 0.15s ease;
}

.history-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.active-sources {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.source-tag {
  font-size: 0.6875rem;
  color: var(--fg-muted);
  background: transparent;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Filters Panel */
.search-filters {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-top: 0.25rem;
  animation: slideDown 0.2s ease;
}

.search-filters.open {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.filter-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.filter-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  cursor: pointer;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.sources-filter {
  margin-bottom: 1rem;
}

.sci-hub-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  cursor: pointer;
}

.sci-hub-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* =============================================================================
   3. SOURCE CHIPS
   ============================================================================= */

.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.source-chip input[type="checkbox"] {
  display: none;
}

.source-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}

.source-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.source-chip.active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--white);
}

/* =============================================================================
   4. SEARCH PROGRESS TRACKER
   ============================================================================= */

.search-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 3rem 2rem;
}

.search-progress__step {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--fg-faint);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.4s var(--ease);
}

.search-progress__step.active {
  color: var(--accent);
}

.search-progress__step.completed {
  color: var(--success);
}

.search-progress__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: all 0.3s var(--ease);
  position: relative;
}

.search-progress__step.active .search-progress__dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
  animation: progressPulse 1.5s ease infinite;
}

.search-progress__step.completed .search-progress__dot {
  background: var(--success);
  box-shadow: none;
  animation: none;
}

.search-progress__step.completed .search-progress__dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--white);
  border-bottom: 1.5px solid var(--white);
  transform: translate(-60%, -65%) rotate(45deg);
}

.search-progress__connector {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 0 0.75rem;
  transition: background 0.4s var(--ease);
  flex-shrink: 0;
}

.search-progress__connector.active {
  background: var(--accent);
}

.search-progress__connector.completed {
  background: var(--success);
}

@keyframes progressPulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-light); }
  50% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0.05); }
}

/* =============================================================================
   5. RESULTS SECTION - Answer-First Layout
   ============================================================================= */

.results-section {
  gap: 0;
}

/* =============================================================================
   6. ANSWER PANEL
   ============================================================================= */

.answer-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: fadeInUp 0.5s var(--ease);
}

.answer-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 1.75rem 0;
  gap: 1rem;
}

.answer-panel__query {
  flex: 1;
}

.answer-panel__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  margin-bottom: 0.25rem;
  display: block;
}

.answer-panel__query h3 {
  font-family: var(--font-serif, var(--font-display));
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--fg);
  margin: 0;
  line-height: 1.4;
  font-style: italic;
}

.ai-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.75rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-model-badge svg {
  width: 12px;
  height: 12px;
}

.answer-panel__body {
  padding: 0;
  color: var(--fg);
  font-size: 14.5px;
  line-height: 1.65;
}

.answer-panel__body .markdown-content {
  font-size: var(--text-base);
}

/* Inline citations */
.citation-ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  background: var(--accent-light);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  vertical-align: super;
  margin: 0 1px;
  transition: all 0.15s ease;
  line-height: 1;
  cursor: pointer;
}

.citation-ref:hover {
  background: var(--accent);
  color: var(--white);
  transform: scale(1.15);
}

/* =============================================================================
   7. SOURCE CARDS STRIP
   ============================================================================= */

.source-cards-strip {
  /* v2: layout handled by academic-v2.css */
}

.source-cards-strip::-webkit-scrollbar {
  display: none;
}

.source-card {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.source-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}

.source-card__badge {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.source-card__badge--arxiv { background: #b31b1b; }
.source-card__badge--semantic { background: #1857b6; }
.source-card__badge--core { background: #6366f1; }
.source-card__badge--crossref { background: #3b82f6; }
.source-card__badge--pubmed { background: #0ea5e9; }
.source-card__badge--ieee { background: #00629b; }
.source-card__badge--openalex { background: #c62828; }
.source-card__badge--unpaywall { background: #2e7d32; }
.source-card__badge--europepmc { background: #00838f; }
.source-card__badge--biorxiv { background: #b7472a; }
.source-card__badge--medrxiv { background: #0d47a1; }
.source-card__badge--google_scholar { background: #4285f4; }
.source-card__badge--iacr { background: #2e7d32; }
.source-card__badge--default { background: var(--fg-faint); }

.source-card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.source-card__title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.source-card__meta {
  font-size: 0.625rem;
  color: var(--fg-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =============================================================================
   8. FOLLOW-UP QUESTIONS
   ============================================================================= */

.follow-up-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.75rem 1.5rem;
  align-items: center;
}

.follow-up-questions__label {
  font-size: var(--text-sm);
  color: var(--fg-faint);
  font-weight: 500;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.follow-up-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  line-height: 1.3;
}

.follow-up-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}

.follow-up-pill svg {
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.follow-up-pill:hover svg {
  opacity: 1;
}

/* =============================================================================
   9. RESULTS META BAR
   ============================================================================= */

.results-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--fg-muted);
  flex-wrap: wrap;
}

.results-meta-bar strong {
  color: var(--fg);
  font-weight: 600;
}

.results-meta-bar__separator {
  color: var(--border);
}

/* =============================================================================
   10. ANALYSIS TOOLS BAR
   ============================================================================= */

.analysis-tools-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.25s ease;
}

.tool-btn__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.tool-btn__icon svg {
  width: 13px;
  height: 13px;
}

.tool-btn--indigo .tool-btn__icon { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.tool-btn--sky .tool-btn__icon    { background: rgba(14, 165, 233, 0.1); color: #0ea5e9; }
.tool-btn--amber .tool-btn__icon  { background: rgba(234, 179, 8, 0.12); color: #ca8a04; }
.tool-btn--orange .tool-btn__icon   { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.tool-btn--emerald .tool-btn__icon  { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.tool-btn--indigo:hover  { border-color: #6366f1; color: #6366f1; background: rgba(99, 102, 241, 0.05); }
.tool-btn--sky:hover     { border-color: #0ea5e9; color: #0ea5e9; background: rgba(14, 165, 233, 0.05); }
.tool-btn--amber:hover   { border-color: #ca8a04; color: #ca8a04; background: rgba(234, 179, 8, 0.05); }
.tool-btn--orange:hover  { border-color: #f97316; color: #f97316; background: rgba(249, 115, 22, 0.05); }
.tool-btn--emerald:hover { border-color: #10b981; color: #10b981; background: rgba(16, 185, 129, 0.05); }

.tool-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tool-btn:hover .tool-btn__icon {
  transform: scale(1.1);
}

/* =============================================================================
   11. PAPER CARDS - Redesigned
   ============================================================================= */

.papers-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.papers-container__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.papers-container__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.papers-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.paper-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: all 0.25s ease;
  position: relative;
}

.paper-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

/* Citation badge */
.paper-card__citation-badge {
  position: absolute;
  top: 1.125rem;
  left: -0.5rem;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
  z-index: 2;
}

/* Card top: title + source chip */
.paper-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
}

.paper-card__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--fg);
  line-height: 1.45;
  flex: 1;
}

.paper-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.paper-card__title a:hover {
  color: var(--accent);
}

.paper-card__source-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.paper-card__source-chip--arxiv {
  background: rgba(179, 27, 27, 0.08);
  color: #b31b1b;
}

.paper-card__source-chip--semantic {
  background: rgba(24, 87, 182, 0.08);
  color: #1857b6;
}

.paper-card__source-chip--core {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}

.paper-card__source-chip--crossref {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
}

.paper-card__source-chip--pubmed {
  background: rgba(14, 165, 233, 0.08);
  color: #0ea5e9;
}

.paper-card__source-chip--ieee {
  background: rgba(0, 98, 155, 0.08);
  color: #00629b;
}

.paper-card__source-chip--openalex {
  background: rgba(198, 40, 40, 0.08);
  color: #c62828;
}

.paper-card__source-chip--unpaywall {
  background: rgba(46, 125, 50, 0.08);
  color: #2e7d32;
}

.paper-card__source-chip--europepmc {
  background: rgba(0, 131, 143, 0.08);
  color: #00838f;
}

.paper-card__source-chip--biorxiv {
  background: rgba(183, 71, 42, 0.08);
  color: #b7472a;
}

.paper-card__source-chip--medrxiv {
  background: rgba(13, 71, 161, 0.08);
  color: #0d47a1;
}

.paper-card__source-chip--google_scholar {
  background: rgba(66, 133, 244, 0.08);
  color: #4285f4;
}

.paper-card__source-chip--iacr {
  background: rgba(46, 125, 50, 0.08);
  color: #2e7d32;
}

/* Meta row */
.paper-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
  padding-left: 0.5rem;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.paper-card__meta-separator {
  color: var(--fg-faint);
  font-size: 0.5rem;
}

.paper-card__categories {
  display: inline-flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.paper-card__category {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.125rem 0.4375rem;
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 500;
}

/* TL;DR */
.paper-card__tldr {
  padding-left: 0.5rem;
  margin-bottom: 0.625rem;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.5;
}

/* Abstract (collapsible) */
.paper-card__abstract {
  padding-left: 0.5rem;
  margin-bottom: 0.75rem;
  position: relative;
}

.paper-card__abstract-text {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all 0.3s ease;
}

.paper-card__abstract-text.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

.paper-card__abstract-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: opacity 0.2s ease;
}

.paper-card__abstract-toggle:hover {
  opacity: 0.8;
}

/* Metrics row */
.paper-card__metrics {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-left: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: var(--text-sm);
  color: var(--fg-faint);
}

.paper-card__metric {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.paper-card__metric svg {
  width: 14px;
  height: 14px;
}

.paper-card__metric--available {
  color: var(--success);
}

.paper-card__metric--unavailable {
  color: var(--fg-faint);
}

/* Actions row */
.paper-card__actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding-left: 0.5rem;
  flex-wrap: wrap;
}

.paper-card__action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--fg-muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.paper-card__action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.paper-card__action--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.paper-card__action--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--white);
}

.paper-card__action--save {
  margin-left: auto;
  border: none;
  padding: 0.375rem;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-card__action--save:hover {
  background: var(--accent-light);
}

.paper-card__action--save.saved svg {
  fill: var(--accent);
  color: var(--accent);
}

.paper-card__action svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Highlight when scrolled-to via citation link */
.paper-card--highlight {
  animation: paperHighlight 2s ease;
}

@keyframes paperHighlight {
  0%, 15% { box-shadow: 0 0 0 3px var(--accent), var(--shadow-md); }
  100% { box-shadow: var(--shadow-sm); }
}

/* =============================================================================
   12. HISTORY DRAWER
   ============================================================================= */

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 100%;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: calc(var(--z-header) + 1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-drawer.open {
  transform: translateX(0);
}

.drawer-overlay {
  display: none;
}

.history-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.history-drawer__header h3 {
  font-family: var(--font-serif, var(--font-display));
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--fg);
  margin: 0;
}

.history-drawer__header p {
  font-size: var(--text-sm);
  color: var(--fg-faint);
  margin: 0.125rem 0 0;
}

.history-drawer__close {
  background: none;
  border: none;
  color: var(--fg-faint);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-drawer__close:hover {
  background: var(--bg-muted);
  color: var(--fg);
}

.history-drawer__search {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.history-drawer__search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s ease;
}

.history-drawer__search input:focus {
  border-color: var(--accent);
}

.history-drawer__search input::placeholder {
  color: var(--fg-faint);
}

.history-drawer__tabs {
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.history-tab {
  padding: 0.625rem 0.875rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--fg-faint);
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-tab:hover {
  color: var(--fg-muted);
}

.history-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.history-drawer__list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1.5rem;
}

.history-drawer__item {
  padding: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-drawer__item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.history-drawer__item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.history-drawer__item-query {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg);
  line-height: 1.4;
}

.history-drawer__item-date {
  font-size: 0.6875rem;
  color: var(--fg-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.history-drawer__item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.history-drawer__item-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.5625rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-drawer__item-preview {
  font-size: 0.6875rem;
  color: var(--fg-faint);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.375rem;
}

.history-drawer__item-actions {
  display: flex;
  gap: 0.375rem;
}

.history-drawer__rerun {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-drawer__rerun:hover {
  background: var(--accent-hover);
}

.history-drawer__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.history-drawer__footer button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: none;
  border: 1px solid var(--error);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-drawer__footer button:hover {
  background: var(--error-light);
}

.history-drawer__empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--fg-faint);
}

.history-drawer__empty svg {
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.history-drawer__empty p {
  font-size: var(--text-sm);
  margin: 0;
}

/* =============================================================================
   13. MODALS
   ============================================================================= */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: var(--z-modal, 1000);
  padding: 2rem;
  overflow-y: auto;
}

.modal.show {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  margin-top: 2rem;
  animation: modalFadeIn 0.2s ease;
}

.modal-content.large-modal {
  max-width: 900px;
}

.modal-content.extra-large-modal {
  max-width: 1100px;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--fg-faint);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-muted);
  color: var(--fg);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  line-height: 1.7;
}

.modal-footer,
.modal-actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* =============================================================================
   14. MARKDOWN CONTENT
   ============================================================================= */

.markdown-content {
  color: var(--fg);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--fg);
}

.markdown-content h1 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.markdown-content h2 { font-size: 1.25rem; }
.markdown-content h3 { font-size: 1.125rem; color: var(--accent); }

.markdown-content p { margin-bottom: 1rem; }

.markdown-content ul,
.markdown-content ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.markdown-content li { margin-bottom: 0.375rem; }

.markdown-content blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-muted);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-style: italic;
}

.markdown-content code {
  background: var(--bg-muted);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--accent);
}

.markdown-content pre {
  background: var(--bg-muted);
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: var(--fg);
}

.markdown-content a {
  color: var(--accent);
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.markdown-content th,
.markdown-content td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.markdown-content th {
  background: var(--bg-muted);
  font-weight: 600;
}

/* =============================================================================
   15. LOADING STATES
   ============================================================================= */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--fg-faint);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  z-index: 999;
}

[data-theme="dark"] .loading-overlay {
  background: rgba(20, 20, 20, 0.9);
}

.loading-overlay.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 3px;
  animation: loadingDot 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--border) 50%, var(--bg-muted) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

/* =============================================================================
   16. FORMS
   ============================================================================= */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--fg);
  font-size: 0.875rem;
}

.form-section {
  background: var(--bg-muted);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.form-section h4 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s ease;
}

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

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.checkbox-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--accent);
}

.checkbox-item .checkmark {
  display: none;
}

/* =============================================================================
   17. TRENDING SECTION
   ============================================================================= */

.trending-section {
  margin-top: 2rem;
  text-align: center;
}

.trending-header {
  margin-bottom: 1rem;
}

.trending-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trending-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.trending-chip {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.trending-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.1);
}

/* =============================================================================
   18. FOOTER
   ============================================================================= */

.app-footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.footer-container {
  max-width: var(--content-width, 860px);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-logo {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.footer-tagline {
  font-size: 0.75rem;
  color: var(--fg-faint);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--fg);
}

/* =============================================================================
   19. BUTTONS (shared)
   ============================================================================= */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  background: var(--bg-muted);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--surface);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-sm);
}

/* =============================================================================
   20. ANIMATIONS
   ============================================================================= */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =============================================================================
   21. EMPTY / ERROR STATES
   ============================================================================= */

.no-results {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--fg-faint);
}

.no-results svg {
  margin-bottom: 1rem;
  opacity: 0.4;
}

.no-results h3 {
  font-family: var(--font-serif, var(--font-display));
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--fg-muted);
}

.no-results p {
  color: var(--fg-faint);
  font-size: 0.9375rem;
}

.error {
  color: var(--error);
  font-style: italic;
}

/* =============================================================================
   22. RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
  .main-content {
    padding: 1.5rem 1rem;
  }

  .search-hero {
    padding: 2rem 0.5rem 1.5rem;
  }

  .search-hero h2 {
    font-size: 1.75rem;
  }

  .search-bar {
    border-radius: 16px;
    padding: 0.375rem 0.375rem 0.375rem 1rem;
  }

  .search-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    border-radius: 12px;
    min-height: 44px;
  }

  .search-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .search-meta__right {
    width: 100%;
    justify-content: space-between;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  /* Progress tracker */
  .search-progress {
    flex-direction: column;
    gap: 0.75rem;
    padding: 2rem 1rem;
  }

  .search-progress__connector {
    width: 2px;
    height: 20px;
    margin: 0;
  }

  /* Answer panel */
  .answer-panel__header {
    flex-direction: column;
    padding: 1.25rem 1.25rem 0;
  }

  .answer-panel__body {
    padding: 1rem 1.25rem;
  }

  .source-cards-strip {
    padding: 0 1.25rem 1rem;
  }

  .follow-up-questions {
    padding: 0 1.25rem 1.25rem;
  }

  /* Paper cards */
  .paper-card {
    padding: 1.25rem;
  }

  .paper-card__citation-badge {
    position: static;
    width: 20px;
    height: 20px;
    font-size: 0.5625rem;
    flex-shrink: 0;
  }

  .paper-card__top {
    padding-left: 0;
  }

  .paper-card__meta,
  .paper-card__tldr,
  .paper-card__abstract,
  .paper-card__metrics,
  .paper-card__actions {
    padding-left: 0;
  }

  .paper-card__actions {
    flex-wrap: wrap;
  }

  .paper-card__action--save {
    margin-left: 0;
  }

  /* Analysis tools */
  .analysis-tools-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .analysis-tools-bar button {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* History drawer */
  .history-drawer {
    width: 100%;
  }

  /* Modals */
  .modal {
    padding: 1rem;
  }

  .modal-content {
    margin-top: 1rem;
    max-height: calc(100vh - 2rem);
    border-radius: var(--radius-lg);
  }

  .modal-content.large-modal,
  .modal-content.extra-large-modal {
    max-width: 100%;
  }

  .modal-header {
    padding: 1rem 1.25rem;
  }

  .modal-body {
    padding: 1.25rem;
  }

  .modal-close {
    width: 40px;
    height: 40px;
    min-width: 44px;
    min-height: 44px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer-container {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    padding: 0 1rem;
  }

  .footer-brand {
    align-items: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  /* Trending */
  .trending-chips {
    gap: 0.625rem;
    padding: 0 0.5rem;
  }

  .trending-chip {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    min-height: 44px;
  }

  .source-chips {
    gap: 0.625rem;
  }

  .source-chip {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    min-height: 40px;
  }

  /* Results meta bar */
  .results-meta-bar {
    flex-wrap: wrap;
    gap: 0.375rem;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 1rem 0.75rem;
  }

  .search-hero {
    padding: 1.5rem 0.25rem 1rem;
  }

  .search-hero h2 {
    font-size: 1.5rem;
  }

  .search-subtitle {
    font-size: 0.9375rem;
  }

  .search-bar {
    flex-direction: column;
    padding: 0.75rem;
    border-radius: 16px;
    gap: 0.75rem;
  }

  .search-bar-icon {
    display: none;
  }

  .search-input {
    width: 100%;
    text-align: center;
    font-size: 1rem;
    padding: 0.5rem;
  }

  .search-btn {
    width: 100%;
    padding: 0.875rem;
    min-height: 48px;
    font-size: 1rem;
    border-radius: 12px;
  }

  .source-card {
    flex: 0 0 160px;
  }

  .follow-up-pill {
    width: 100%;
  }

  .paper-card {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }

  /* Modal controls mobile */
  .modal-controls {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .modal-controls select {
    width: 100%;
    min-height: 44px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-actions button {
    width: 100%;
    min-height: 48px;
  }

  .form-section {
    padding: 1rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions button {
    width: 100%;
    min-height: 48px;
  }

  .trending-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    justify-content: flex-start;
  }

  .trending-chip {
    flex-shrink: 0;
  }
}

/* =============================================================================
   23. PRINT STYLES
   ============================================================================= */

@media print {
  .app-header,
  .search-section,
  .modal,
  .loading-overlay,
  .trending-section,
  .app-footer,
  .history-drawer,
  .drawer-overlay,
  .analysis-tools-bar,
  .search-progress,
  .follow-up-questions {
    display: none !important;
  }

  .paper-card__actions {
    display: none !important;
  }
}

/* =============================================================================
   24. LEGACY / COMPATIBILITY
   ============================================================================= */

.analysis-content {
  color: var(--fg-muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

.suggestions-btn {
  margin-top: 1rem;
  width: 100%;
  justify-content: center;
}

.trending-category {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.trending-category:last-child {
  border-bottom: none;
}

.trending-category h4 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.trending-category ul {
  list-style: none;
  padding: 0;
}

.trending-category li {
  margin-bottom: 0.25rem;
}

.trending-category a {
  color: var(--fg-muted);
  text-decoration: none;
}

.trending-category a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.status-active {
  background: var(--success-light);
  color: var(--success);
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: var(--radius-sm);
}

.status-inactive {
  background: var(--error-light);
  color: var(--error);
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: var(--radius-sm);
}

/* =============================================================================
   25. REDESIGNED MODAL HEADERS
   ============================================================================= */

.modal-header__left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex: 1;
  min-width: 0;
}

.modal-header__left h3 {
  font-family: var(--font-serif, var(--font-display));
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.3;
}

.modal-header__sub {
  font-size: 0.75rem;
  color: var(--fg-faint);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.modal-header__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lit-review-icon {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.methodology-icon {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(14, 165, 233, 0.04));
  color: #0ea5e9;
  border: 1px solid rgba(14, 165, 233, 0.15);
}

.suggestions-icon {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.14), rgba(234, 179, 8, 0.04));
  color: #ca8a04;
  border: 1px solid rgba(234, 179, 8, 0.18);
}

.framework-icon {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(249, 115, 22, 0.04));
  color: var(--accent);
  border: 1px solid rgba(249, 115, 22, 0.15);
}

[data-theme="dark"] .lit-review-icon {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.08));
  border-color: rgba(99, 102, 241, 0.25);
}
[data-theme="dark"] .methodology-icon {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.08));
  border-color: rgba(14, 165, 233, 0.25);
}
[data-theme="dark"] .suggestions-icon {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.08));
  border-color: rgba(234, 179, 8, 0.25);
}
[data-theme="dark"] .framework-icon {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.08));
  border-color: rgba(249, 115, 22, 0.25);
}

/* =============================================================================
   26. LITERATURE REVIEW - CONFIG BAR
   ============================================================================= */

.lit-review-config {
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.config-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
}

.config-field {
  flex: 1;
  min-width: 0;
}

.config-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  margin-bottom: 0.5rem;
}

.config-chips {
  display: flex;
  gap: 0.375rem;
}

.config-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.config-chip:hover {
  border-color: #6366f1;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.06);
}

.config-chip.active {
  background: rgba(99, 102, 241, 0.1);
  border-color: #6366f1;
  color: #6366f1;
  font-weight: 600;
}

.config-chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.config-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--fg);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239C9590' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.config-select:focus {
  outline: none;
  border-color: #6366f1;
}

/* =============================================================================
   27. ANALYSIS PLACEHOLDER STATE
   ============================================================================= */

.analysis-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.analysis-placeholder__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: var(--fg-faint);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  position: relative;
}

.analysis-placeholder__icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  animation: placeholderSpin 20s linear infinite;
}

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

.analysis-placeholder__text {
  font-family: var(--font-serif, var(--font-display));
  font-size: 1rem;
  color: var(--fg-muted);
  margin: 0 0 0.375rem;
  font-weight: 500;
}

.analysis-placeholder__sub {
  font-size: 0.8125rem;
  color: var(--fg-faint);
  margin: 0;
}

.suggestions-placeholder-glow {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.1), rgba(234, 179, 8, 0.03));
  border-color: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.framework-placeholder-glow {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.03));
  border-color: rgba(249, 115, 22, 0.15);
  color: var(--accent);
}

/* =============================================================================
   28. MODAL ACTIONS BAR (bottom toolbar)
   ============================================================================= */

.modal-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0 0;
  border-top: 1px solid var(--border);
  margin-top: 1.25rem;
}

.modal-actions-bar__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-actions-bar__right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-actions-bar__status {
  font-size: 0.75rem;
  color: var(--fg-faint);
  font-style: italic;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  white-space: nowrap;
}

.action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.action-btn--primary {
  background: var(--accent);
  color: var(--white);
}

.action-btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.action-btn--ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.action-btn--ghost:hover {
  border-color: var(--border-hover);
  color: var(--fg);
  background: var(--bg-muted);
}

.action-btn--full {
  width: 100%;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  border-radius: var(--radius-lg);
  margin-top: 0.5rem;
}

/* =============================================================================
   29. METHODOLOGY - FORM REDESIGN
   ============================================================================= */

.methodology-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.meth-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meth-input-group--narrow {
  max-width: 180px;
}

.meth-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-faint);
}

.meth-label svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.meth-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  outline: none;
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.meth-textarea:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.08);
}

.meth-textarea::placeholder {
  color: var(--fg-faint);
}

.meth-options-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.meth-type-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.meth-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.875rem 0.5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.meth-type-card input[type="radio"] {
  display: none;
}

.meth-type-card svg {
  color: var(--fg-faint);
  transition: color 0.2s ease;
}

.meth-type-card__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg-muted);
  transition: color 0.2s ease;
}

.meth-type-card__desc {
  font-size: 0.6875rem;
  color: var(--fg-faint);
  line-height: 1.3;
}

.meth-type-card:hover {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.04);
}

.meth-type-card:hover svg {
  color: #0ea5e9;
}

.meth-type-card.active,
.meth-type-card:has(input:checked) {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.08);
}

.meth-type-card.active svg,
.meth-type-card:has(input:checked) svg {
  color: #0ea5e9;
}

.meth-type-card.active .meth-type-card__title,
.meth-type-card:has(input:checked) .meth-type-card__title {
  color: #0ea5e9;
}

/* =============================================================================
   30. RESPONSIVE - REDESIGNED MODALS
   ============================================================================= */

@media (max-width: 768px) {
  .config-row {
    flex-direction: column;
    gap: 1rem;
  }

  .config-chips {
    flex-wrap: wrap;
  }

  .meth-options-row {
    flex-direction: column;
    gap: 1rem;
  }

  .meth-input-group--narrow {
    max-width: 100%;
  }

  .meth-type-cards {
    grid-template-columns: 1fr;
  }

  .modal-actions-bar {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .modal-actions-bar__right {
    justify-content: flex-end;
  }

  .modal-header__left h3 {
    font-size: 1rem;
  }
}

/* =============================================================================
   PAPER SELECTION CHECKBOXES
   ============================================================================= */

.paper-card__select {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-card__checkbox {
  display: none;
}

.paper-card__checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: var(--surface);
}

.paper-card__checkmark::after {
  content: '';
  display: none;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.paper-card__checkbox:checked + .paper-card__checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.paper-card__checkbox:checked + .paper-card__checkmark::after {
  display: block;
}

.paper-card__select:hover .paper-card__checkmark {
  border-color: var(--accent);
}

/* Selection bar */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--accent-light, rgba(99, 102, 241, 0.08));
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  color: var(--fg);
  margin-bottom: 1rem;
}

.selection-bar__btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.selection-bar__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.selection-bar__btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.selection-bar__btn--primary:hover {
  opacity: 0.9;
  color: white;
}

.papers-container__select-all {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.papers-container__select-all:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =============================================================================
   WORKFLOW PROGRESS INDICATOR
   ============================================================================= */

.workflow-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1rem 0 1.5rem;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-faint);
  transition: all 0.3s ease;
  cursor: default;
  white-space: nowrap;
}

.workflow-step__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  border: 2px solid var(--border);
  color: var(--fg-faint);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.workflow-step.completed .workflow-step__icon {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.workflow-step.active .workflow-step__icon {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.workflow-step.completed {
  color: var(--accent);
}

.workflow-step.active {
  color: var(--fg);
  font-weight: 600;
}

.workflow-connector {
  width: 2rem;
  height: 2px;
  background: var(--border);
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.workflow-connector.done {
  background: var(--accent);
}

@media (max-width: 640px) {
  .workflow-step span:not(.workflow-step__icon) {
    display: none;
  }
  .workflow-connector {
    width: 1.5rem;
  }
}

/* =============================================================================
   CITATION EXPORT MODAL
   ============================================================================= */

.citation-export-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.citation-format-chip {
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full, 9999px);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--surface);
  color: var(--fg-muted);
}

.citation-format-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.citation-format-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.citation-output {
  background: var(--surface-alt, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.7;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--fg);
}

/* =============================================================================
   SHAREABLE SEARCH LINK
   ============================================================================= */

.share-link-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.share-link-bar__input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-family: monospace;
  background: var(--surface);
  color: var(--fg);
}

.share-link-bar__btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.share-link-bar__btn:hover {
  opacity: 0.9;
}

/* =============================================================================
   STREAMING CURSOR & LIVE PREVIEW
   ============================================================================= */

.stream-cursor {
  min-height: 2rem;
}

.stream-cursor::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: streamBlink 0.8s steps(2) infinite;
  margin-left: 2px;
}

@keyframes streamBlink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

/* While streaming, show cursor at end of content */
.review-content:has(.stream-cursor),
.methodology-content:has(.stream-cursor),
.framework-content:has(.stream-cursor),
.suggestions-content:has(.stream-cursor) {
  position: relative;
}

/* Streaming content container gets auto-scroll-ready max-height */
#reviewContent,
#methodologyContent,
#frameworkContent,
#suggestionsContent {
  max-height: 60vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Add a subtle streaming indicator bar at top of content */
#reviewContent:has(> :first-child:not(p):not(h1):not(h2))::before,
#methodologyContent:has(> :first-child:not(p):not(h1):not(h2))::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: streamShimmer 1.5s ease-in-out infinite;
  margin-bottom: 1rem;
  border-radius: 1px;
}

@keyframes streamShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =============================================================================
   PDF TEXT EXTRACTION
   ============================================================================= */

.pdf-extract-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  flex-wrap: wrap;
  border: 1px solid var(--border);
}

.pdf-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  font-weight: 500;
}

.pdf-stat svg {
  color: var(--accent);
  flex-shrink: 0;
}

.pdf-extracted-text {
  max-height: 50vh;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  line-height: 1.8;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono, 'SFMono-Regular', 'Menlo', monospace);
}

.pdf-extracted-text::-webkit-scrollbar {
  width: 6px;
}

.pdf-extracted-text::-webkit-scrollbar-track {
  background: transparent;
}

.pdf-extracted-text::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.action-btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* =============================================================================
   REDESIGNED MODAL INTERIORS — Lit Review, Methodology, Suggestions
   Magazine-editorial aesthetic with deep scholarly character
   ============================================================================= */

/* -- Shared streaming content polish -- */
.review-content h1, .review-content h2,
.methodology-content h1, .methodology-content h2,
.framework-content h1, .framework-content h2,
.suggestions-content h1, .suggestions-content h2 {
  font-family: var(--font-serif, var(--font-display));
  font-weight: 600;
  letter-spacing: -0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  margin-top: 1.75rem;
  margin-bottom: 1rem;
}

.review-content h1:first-child,
.methodology-content h1:first-child,
.framework-content h1:first-child,
.suggestions-content h1:first-child {
  margin-top: 0;
}

.review-content h2,
.methodology-content h2,
.framework-content h2,
.suggestions-content h2 {
  font-size: 1.125rem;
  color: var(--fg);
}

.review-content h3,
.methodology-content h3,
.framework-content h3,
.suggestions-content h3 {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin-top: 1.5rem;
  margin-bottom: 0.625rem;
}

.review-content strong,
.methodology-content strong,
.framework-content strong,
.suggestions-content strong {
  font-weight: 700;
  color: var(--fg);
}

.review-content ul, .review-content ol,
.methodology-content ul, .methodology-content ol,
.framework-content ul, .framework-content ol,
.suggestions-content ul, .suggestions-content ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.review-content li,
.methodology-content li,
.framework-content li,
.suggestions-content li {
  margin-bottom: 0.375rem;
  line-height: 1.65;
}

.review-content li::marker,
.methodology-content li::marker,
.framework-content li::marker,
.suggestions-content li::marker {
  color: var(--accent);
}

.review-content p,
.methodology-content p,
.framework-content p,
.suggestions-content p {
  margin: 0.5rem 0;
  line-height: 1.75;
}

/* Scrollbar styling for modal content areas */
#reviewContent::-webkit-scrollbar,
#methodologyContent::-webkit-scrollbar,
#frameworkContent::-webkit-scrollbar,
#suggestionsContent::-webkit-scrollbar {
  width: 5px;
}

#reviewContent::-webkit-scrollbar-thumb,
#methodologyContent::-webkit-scrollbar-thumb,
#frameworkContent::-webkit-scrollbar-thumb,
#suggestionsContent::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* -- Lit Review header accent line -- */
.lit-review-header {
  border-bottom: none;
  position: relative;
  padding-bottom: 1rem;
}

.lit-review-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #a78bfa, transparent);
  border-radius: 2px;
}

/* -- Methodology header accent line -- */
.methodology-header {
  border-bottom: none;
  position: relative;
  padding-bottom: 1rem;
}

.methodology-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 3px;
  background: linear-gradient(90deg, #0ea5e9, #7dd3fc, transparent);
  border-radius: 2px;
}

/* -- Framework / Suggestions header accent line -- */
.framework-header {
  border-bottom: none;
  position: relative;
  padding-bottom: 1rem;
}

.framework-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #fdba74, transparent);
  border-radius: 2px;
}

.suggestions-header {
  border-bottom: none;
  position: relative;
  padding-bottom: 1rem;
}

.suggestions-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 3px;
  background: linear-gradient(90deg, #eab308, #fde68a, transparent);
  border-radius: 2px;
}

/* -- Enhanced modal backdrop -- */
.modal.show {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* -- Elevated modal content with paper-like texture -- */
.large-modal {
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.03),
    0 8px 40px rgba(0,0,0,0.12),
    0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="dark"] .large-modal {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 8px 40px rgba(0,0,0,0.4),
    0 2px 8px rgba(0,0,0,0.2);
}
/* =============================================================================
   ACADEMIC SEARCH — v2 Design Override
   Inspector variant: compact, mono metadata, warm bone palette
   Loads AFTER academic.css to override key visual properties
   ============================================================================= */

/* ── Inspector variant accent color (violet) ── */
:root {
  --inspector-accent: #3D2FB3;
  --inspector-soft: rgba(61, 47, 179, 0.08);
}

/* ── Remove luxury decorative elements ── */
.app-container::before { display: none; }
.app-container { position: static; }

/* ── Main content — constraints removed in academic.css directly ── */

/* Constrain the search section to center when no results */
.search-section {
  max-width: 720px !important;
  margin: 0 auto !important;
  padding: 16px 20px !important;
  transition: all 0.2s ease;
}
.trending-section {
  max-width: 720px !important;
  margin: 0 auto !important;
}

/* ── Collapse search when results are showing ── */
.search-section.has-results {
  max-width: none !important;
  padding: 8px 16px !important;
  margin: 0 !important;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.search-section.has-results .search-hero {
  display: none !important;
}
.search-section.has-results .search-bar {
  max-width: 600px;
}
.search-section.has-results .search-meta {
  max-width: 600px;
}
.search-section.has-results .search-filters {
  max-width: 600px;
}
/* Hide workflow progress in collapsed mode */
.search-section.has-results + .trending-section,
.search-section.has-results ~ .trending-section {
  display: none !important;
}
.search-section.has-results ~ .workflow-progress {
  display: none !important;
}

/* ── Search Hero: compact, left-aligned ── */
.search-hero {
  text-align: left;
  padding: 16px 0 12px;
}
.search-hero h2 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.3px;
}
.search-subtitle {
  font-size: 12px;
  color: var(--fg-faint);
  text-align: left;
  margin-bottom: 14px;
}

/* ── Search Bar: solid border, compact, rounded ── */
.search-bar {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 14px;
  box-shadow: none;
  background: var(--surface);
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.search-input {
  font-size: 13px;
  font-family: var(--font-sans);
  border: none !important;
  padding: 6px 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.search-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
}
.search-btn:hover { background: var(--accent); }

/* ── Filters: mono, compact chips ── */
.search-meta { gap: 6px; }
.filters-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.search-filters {
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
}
.filter-group label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
}
.filter-group select, .filter-group input {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.source-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

/* ── History toggle ── */
.history-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

/* ── Trending: mono labels, pill chips ── */
.trending-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--fg-faint);
}
.trending-chip {
  border-radius: var(--radius-full);
  font-size: 12px;
  padding: 5px 12px;
}

/* ── Workflow Progress: mono, compact ── */
.workflow-progress {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 10px 20px;
  gap: 0;
}
.workflow-step {
  font-size: 10px;
  gap: 5px;
}
.workflow-step__icon {
  width: 16px;
  height: 16px;
  font-size: 9px;
  border-radius: 8px;
}
.workflow-connector { max-width: 60px; }

/* ── Answer Panel: full-width, no card — flows naturally ── */
.answer-panel {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.answer-panel__header {
  padding: 0 0 10px;
  border-bottom: none;
}
.answer-panel__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-faint);
  font-weight: 500;
}
.answer-panel__query h3 {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.2;
  margin-top: 4px;
}
.answer-panel__query h3 span {
  color: var(--fg-faint);
  font-weight: 400;
}
.ai-model-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  color: var(--fg-faint);
}
.answer-panel__body {
  padding: 0;
  font-size: 14.5px;
  line-height: 1.65;
}

/* ── Answer body markdown rendering ── */
.answer-panel__body h1,
.answer-panel__body h2,
.answer-panel__body h3,
.answer-panel__body h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--fg);
  margin: 18px 0 8px;
  line-height: 1.3;
}
.answer-panel__body h1 { font-size: 20px; }
.answer-panel__body h2 { font-size: 17px; }
.answer-panel__body h3 { font-size: 15px; }
.answer-panel__body h4 { font-size: 14px; color: var(--inspector-accent, #3D2FB3); }
.answer-panel__body p { margin: 0 0 10px; }
.answer-panel__body ul, .answer-panel__body ol {
  margin: 0 0 10px;
  padding-left: 20px;
}
.answer-panel__body li { margin-bottom: 4px; }
.answer-panel__body strong { font-weight: 600; color: var(--fg); }
.answer-panel__body blockquote {
  border-left: 2px solid var(--inspector-accent, #3D2FB3);
  padding: 8px 12px;
  margin: 10px 0;
  font-style: italic;
  color: var(--fg-muted);
  font-size: 13px;
}
.answer-panel__body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-muted);
  padding: 1px 4px;
  border-radius: 2px;
}

/* ── Tighter source cards + follow-ups ── */
.source-cards-strip { padding: 8px 0; }
.follow-up-questions { padding: 0; }

/* Follow-up section — vertical list with arrows */
.followup-section {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.followup-section__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--fg-faint);
  margin-bottom: 10px;
}
.followup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition-fast);
}
.followup-item:hover { background: var(--bg-muted); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 4px; }
.followup-item__arrow {
  color: var(--inspector-accent, #3D2FB3);
  font-family: var(--font-mono);
  font-size: 12px;
  flex-shrink: 0;
}
.followup-item__text {
  font-size: 13px;
  color: var(--fg);
}

/* ── Citations: mono, violet colored (Inspector variant) ── */
.citation-ref {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  background: var(--inspector-soft, rgba(61,47,179,0.08));
  color: var(--inspector-accent, #3D2FB3);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  margin: 0 1px;
  vertical-align: middle;
}
.citation-ref:hover {
  background: var(--inspector-accent, #3D2FB3);
  color: var(--white);
}

/* ── Source Cards: cited strip ── */
.source-cards-strip {
  margin-top: 22px;
}
.source-cards-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.source-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px;
  min-width: 200px;
  max-width: 200px;
  background: var(--surface);
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  color: var(--fg);
  display: flex;
  flex-direction: column;
}
.source-card:hover { border-color: var(--inspector-accent, #3D2FB3); }
.source-card__header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  margin-bottom: 6px;
}
.source-card__ref { color: var(--fg-faint); }
.source-card__year { color: var(--fg-faint); }
.source-card__title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.source-card__cites {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  margin-top: 8px;
}

/* ── Follow-ups: bordered pills ── */
.follow-up-questions {
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
}
.follow-up-btn {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
}
.follow-up-btn:hover {
  border-color: var(--fg);
  color: var(--fg);
}

/* ── Results Meta Bar: mono ── */
.results-meta-bar {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 8px 0;
  color: var(--fg-faint);
}

/* ── Analysis Tools Bar: hidden in Inspector layout (moved to source rail) ── */
.inspector-layout .analysis-tools-bar {
  display: none !important;
}
.analysis-tools-bar {
  gap: 6px;
  padding: 10px 0;
}
.tool-btn {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
}
.tool-btn:hover {
  border-color: var(--fg);
}

/* ── Selection Bar: mono ── */
.selection-bar {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border);
}
.selection-bar__btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}
.selection-bar__btn--accent {
  background: var(--accent);
  color: var(--white);
}

/* ── Paper Cards: dense, horizontal layout ── */
.papers-container__header {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-faint);
}
.paper-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 8px;
  background: var(--surface);
  transition: var(--transition-fast);
}
.paper-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}
.paper-card__citation-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
}
.paper-card__source-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 2px;
}
.paper-card__title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}
.paper-card__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
}
.paper-card__authors {
  font-family: var(--font-sans);
  font-size: 11px;
  font-style: italic;
  color: var(--fg-muted);
}
.paper-card__year {
  font-family: var(--font-mono);
  font-size: 10px;
}
.paper-card__category {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
}
.paper-card__tldr {
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-muted);
}
.paper-card__metrics {
  font-family: var(--font-mono);
  font-size: 10px;
}
.paper-card__actions {
  gap: 4px;
}
.paper-card__action {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
.paper-card__action:hover {
  border-color: var(--fg);
  color: var(--fg);
}

/* ── Search Progress: mono steps ── */
.search-progress {
  font-family: var(--font-mono);
  font-size: 10px;
}
.search-progress__dot {
  width: 8px;
  height: 8px;
}

/* ── Modals: clean borders ── */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
}
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
}
.modal-body { padding: 16px 18px; }
.modal-close {
  font-size: 18px;
  color: var(--fg-faint);
}

/* ── History Drawer: cleaner ── */
.history-drawer {
  border-left: 1px solid var(--border);
  background: var(--surface);
}
.history-drawer__header h3 {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
}
.history-drawer__header p {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
}

/* ── Quick Access Cards (Home state) ── */
.quick-access-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 640px;
  margin: 24px auto 0;
}
.quick-access-card {
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.quick-access-card:hover {
  border-style: solid;
  border-color: var(--border-hover);
}
.quick-access-card__label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-faint);
  margin-bottom: 4px;
}
.quick-access-card__title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 2px;
}
.quick-access-card__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
}

/* ── Lit Review Modal — split panel ── */
.lit-review-header,
.suggestions-header {
  padding: 14px 18px !important;
}
.lit-review-header h3,
.suggestions-header h3 {
  font-family: var(--font-sans) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}
.modal-header__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
}
.lit-review-config {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.config-label {
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
}
.config-chip {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}
.config-chip.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.config-select {
  font-size: 11px !important;
  padding: 5px 10px !important;
  border-radius: var(--radius-sm) !important;
}
.review-content,
.suggestions-content {
  padding: 16px 18px;
}
.analysis-placeholder__icon {
  opacity: 0.3;
}
.analysis-placeholder__text {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg-muted);
}
.analysis-placeholder__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
}

/* =============================================================================
   INSPECTOR 3-COLUMN LAYOUT
   ============================================================================= */

/* Hidden by default — JS adds .inspector-active when results display */
.results-section.inspector-layout {
  display: none;
}
.results-section.inspector-layout.inspector-active {
  display: grid !important;
  grid-template-columns: 240px 1fr 340px !important;
  grid-template-rows: 1fr !important;
  max-width: none !important;
  width: 100vw !important;
  height: calc(100vh - 40px) !important;
  position: fixed !important;
  top: 40px !important;
  left: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
  z-index: 10;
}

/* ── Left: Source Rail ── */

.inspector-sources,
aside.inspector-sources {
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  overflow: hidden;
  background: var(--bg);
  height: 100%;
}
.inspector-sources__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.inspector-sources__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--fg-faint);
}
.inspector-sources__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
}
.inspector-sources__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.source-rail-item {
  padding: 7px 8px;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.source-rail-item:hover { background: var(--bg-muted); }
.source-rail-item.active {
  background: var(--bg-muted);
  border: 1px solid var(--border);
}
.source-rail-item__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.source-rail-item__name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  color: var(--fg);
}
.source-rail-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.source-rail-item__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.source-rail-item__bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.source-rail-item__bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Tools section in source rail */
.inspector-sources__tools {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.inspector-tool-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}
.inspector-tool-btn:last-child { border-bottom: none; }
.inspector-tool-btn:hover { color: var(--accent); }
.inspector-tool-btn span { color: var(--fg-faint); font-size: 11px; }

/* ── Center: Answer + Papers ── */

.inspector-center {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  padding: 20px 24px 60px;
  height: 100%;
}
/* Content fills center column naturally now */
.inspector-center .answer-panel {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}
.inspector-center .answer-panel {
  border: none;
  border-radius: 0;
}
.inspector-center .answer-panel__body {
  padding: 0;
  font-size: 14.5px;
  line-height: 1.65;
}

/* Synthesis badges row */
.answer-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.answer-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}
.answer-badge--primary {
  background: var(--inspector-accent, #3D2FB3);
  color: var(--white);
}
.answer-badge--meta {
  background: var(--surface);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

/* ── Right: Inspector Panel ── */

.inspector-panel,
aside.inspector-panel {
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.inspector-panel__tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.inspector-panel__tab {
  flex: 1;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  cursor: pointer;
  color: var(--fg-faint);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  transition: var(--transition-fast);
}
.inspector-panel__tab:hover { color: var(--fg-muted); }
.inspector-panel__tab.active {
  color: var(--fg);
  border-bottom-color: var(--inspector-accent, #3D2FB3);
}
.inspector-panel__body {
  flex: 1;
  padding: 14px;
}
.inspector-panel__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--fg-faint);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* Inspector paper detail */
.inspector-detail__cited {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--inspector-accent, #3D2FB3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}
.inspector-detail__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}
.inspector-detail__meta {
  font-size: 12px;
  color: var(--fg-faint);
  margin-bottom: 12px;
}
.inspector-detail__quote {
  background: var(--bg-muted);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.inspector-detail__quote-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-faint);
  margin-bottom: 4px;
}
.inspector-detail__quote-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg);
  font-style: italic;
}
.inspector-detail__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}
.inspector-stat {
  padding: 7px 9px;
  background: var(--bg-muted);
  border-radius: 5px;
}
.inspector-stat__label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.inspector-stat__value {
  font-size: 13px;
  font-weight: 600;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.inspector-detail__actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.inspector-action-btn {
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  color: var(--fg);
  transition: var(--transition-fast);
}
.inspector-action-btn:hover { border-color: var(--fg); }
.inspector-action-btn--primary {
  background: var(--inspector-accent, #3D2FB3);
  color: var(--white);
  border: none;
}
.inspector-action-btn--primary:hover { background: #2D1FA3; }

/* =============================================================================
   GRAPH CANVAS VIEW
   ============================================================================= */

.view-toggle {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}
.view-toggle__btn {
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}
.view-toggle__btn:hover { color: var(--fg); }
.view-toggle__btn.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.graph-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 400px;
  background-image: radial-gradient(rgba(0,0,0,0.06) 1px, transparent 1px);
  background-size: 18px 18px;
  background-color: #F2F0EC;
  overflow: hidden;
}

.graph-legend {
  position: absolute;
  top: 14px;
  left: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-faint);
  background: var(--surface);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  line-height: 1.6;
  z-index: 2;
}
.graph-legend__title {
  color: var(--fg);
  font-weight: 500;
  margin-bottom: 4px;
}
.graph-legend__item--accent { color: #2E5D52; }

.graph-toolbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 2;
}
.graph-toolbar__btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 14px;
  transition: var(--transition-fast);
}
.graph-toolbar__btn:hover { background: var(--bg-muted); color: var(--fg); }
.graph-toolbar__btn--accent {
  width: auto;
  padding: 0 10px;
  background: #2E5D52;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: 5px;
}
.graph-toolbar__btn--accent:hover { background: #245048; }
.graph-toolbar__divider {
  width: 1px;
  background: var(--border);
  margin: 4px;
}

.graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.graph-svg text { -webkit-user-select: none; user-select: none; }
.graph-node { cursor: pointer; }
.graph-node:hover circle { stroke-width: 2.5; }
.graph-edge { pointer-events: none; }

/* ── Responsive: collapse to single column on small screens ── */
@media (max-width: 1024px) {
  .inspector-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .inspector-sources { display: none; }
  .inspector-panel { display: none; }
  .inspector-center { overflow: visible; }
}

/* ── Hide page scroll when inspector is active ── */
body:has(.inspector-active) {
  overflow: hidden !important;
}

/* ── Dark mode adjustments ── */
[data-theme="dark"] .paper-card { background: var(--bg-muted); border-color: var(--border); }
[data-theme="dark"] .answer-panel { background: var(--bg-muted); }
[data-theme="dark"] .search-bar { background: var(--bg-muted); }
[data-theme="dark"] .inspector-sources { background: var(--bg); }
[data-theme="dark"] .inspector-panel { background: var(--bg-muted); }
[data-theme="dark"] .inspector-stat { background: var(--bg); }
[data-theme="dark"] .inspector-detail__quote { background: var(--bg); }

/* ── Evidence Callout Blocks ── */
.evidence-callout {
  border-left: 2px solid var(--inspector-accent, #3D2FB3);
  padding: 8px 12px;
  margin: 10px 0;
  font-size: 12.5px;
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.5;
}
.evidence-callout__label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--inspector-accent, #3D2FB3);
  margin-bottom: 4px;
  font-style: normal;
  font-weight: 600;
}
