/* ==========================================================================
   DESK — Visual Language & Design System
   Palette: Slate 50/950, Teal 500, Slate 200/800, Amber/Red/Teal Alerts
   Typography: Inter / System Sans-serif, High contrast, generous line-height
   Styling: Rounded corners (12px to 16px), subtle shadows, flat-glass nav
   ========================================================================== */

:root {
  /* Core Base Colors (Light Mode) */
  --bg-base: #f8fafc; /* Slate 50 */
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9; /* Slate 100 */
  --bg-input: #ffffff;
  
  /* Borders & Dividers */
  --border-color: #e2e8f0; /* Slate 200 */
  --border-subtle: #f1f5f9;
  --border-focus: #14b8a6; /* Teal 500 */
  
  /* Text */
  --text-primary: #0f172a; /* Slate 900 */
  --text-secondary: #475569; /* Slate 600 */
  --text-muted: #94a3b8; /* Slate 400 */
  --text-on-accent: #ffffff;
  
  /* Primary Accent: Vibrant Teal */
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6; /* Brand Vibrant Accent */
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-glow: rgba(20, 184, 166, 0.28);
  --teal-tint: rgba(20, 184, 166, 0.08);
  --teal-subtle-border: rgba(20, 184, 166, 0.3);

  /* Alert / Synthesis Visual Colors */
  /* Patterns (Teal) */
  --pattern-bg: #f0fdfa;
  --pattern-border: #99f6e4;
  --pattern-text: #0f766e;
  --pattern-badge-bg: #ccfbf1;
  --pattern-badge-text: #0d9488;

  /* Conflicts (Red) */
  --conflict-bg: #fef2f2;
  --conflict-border: #fecaca;
  --conflict-text: #991b1b;
  --conflict-badge-bg: #fee2e2;
  --conflict-badge-text: #dc2626;

  /* Gaps (Amber) */
  --gap-bg: #fffbeb;
  --gap-border: #fde68a;
  --gap-text: #92400e;
  --gap-badge-bg: #fef3c7;
  --gap-badge-text: #d97706;

  /* Navigation Flat-Glass */
  --nav-bg: rgba(248, 250, 252, 0.85);
  --nav-border: rgba(226, 232, 240, 0.85);
  --glass-blur: 16px;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -3px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 16px rgba(20, 184, 166, 0.3);
  --shadow-drawer: -8px 0 32px rgba(15, 23, 42, 0.12);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --line-height-normal: 1.6;
  --line-height-tight: 1.25;

  /* Layout Constants */
  --header-height: 64px;
  --bottom-nav-height: 68px;
  --sidebar-width: 260px;
  --content-max-width: 800px;
}

/* ==========================================================================
   Dark Mode Palette (Slate 950 base)
   ========================================================================== */
[data-theme="dark"] {
  --bg-base: #020617; /* Slate 950 */
  --bg-surface: #0b1120;
  --bg-surface-elevated: #0f172a; /* Slate 900 */
  --bg-card: #0f172a; /* Slate 900 */
  --bg-card-hover: #1e293b; /* Slate 800 */
  --bg-input: #070c18;

  --border-color: #1e293b; /* Slate 800 */
  --border-subtle: #172236;
  --border-focus: #2dd4bf;

  --text-primary: #f8fafc; /* Slate 50 */
  --text-secondary: #94a3b8; /* Slate 400 */
  --text-muted: #64748b; /* Slate 500 */

  --teal-tint: rgba(20, 184, 166, 0.12);
  --teal-subtle-border: rgba(45, 212, 191, 0.25);

  /* Patterns (Teal Dark) */
  --pattern-bg: rgba(20, 184, 166, 0.1);
  --pattern-border: rgba(45, 212, 191, 0.35);
  --pattern-text: #5eead4;
  --pattern-badge-bg: rgba(20, 184, 166, 0.2);
  --pattern-badge-text: #2dd4bf;

  /* Conflicts (Red Dark) */
  --conflict-bg: rgba(239, 68, 68, 0.1);
  --conflict-border: rgba(248, 113, 113, 0.35);
  --conflict-text: #fca5a5;
  --conflict-badge-bg: rgba(239, 68, 68, 0.2);
  --conflict-badge-text: #f87171;

  /* Gaps (Amber Dark) */
  --gap-bg: rgba(245, 158, 11, 0.1);
  --gap-border: rgba(251, 191, 36, 0.35);
  --gap-text: #fcd34d;
  --gap-badge-bg: rgba(245, 158, 11, 0.2);
  --gap-badge-text: #fbbf24;

  /* Flat-Glass Navigation */
  --nav-bg: rgba(2, 6, 23, 0.85);
  --nav-border: rgba(30, 41, 59, 0.8);

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(45, 212, 191, 0.3);
  --shadow-drawer: -8px 0 36px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: var(--teal-500);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--teal-400);
}

/* Utility Hidden */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Layout Architecture (The Shell)
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-base);
}

/* App Main Wrapper */
.app-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* Centered Main Content Area */
.main-content-column {
  flex: 1;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 24px 20px 100px 20px; /* bottom padding clears mobile nav */
  position: relative;
}

/* Views Management */
.tab-view {
  display: none;
  animation: fadeInView 0.22s ease-out;
}

.tab-view.active {
  display: block;
}

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

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

.view-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: var(--line-height-tight);
  margin-bottom: 6px;
}

.view-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Header (Sticky Top)
   ========================================================================== */
.main-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  background-color: var(--nav-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-color);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.header-inner {
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Logo "Desk" in bold Teal */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  user-select: none;
  cursor: pointer;
}

.logo-text {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--teal-500);
  text-shadow: 0 0 20px var(--teal-glow);
  transition: transform 0.15s ease;
}

.header-logo:hover .logo-text {
  transform: scale(1.02);
}

.logo-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-card-hover);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Project Selector Pill Button */
.project-selector-wrapper {
  position: relative;
}

.project-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  max-width: 220px;
}

.project-pill-btn:hover {
  border-color: var(--teal-500);
  background-color: var(--bg-card-hover);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--teal-500);
  box-shadow: 0 0 8px var(--teal-500);
  flex-shrink: 0;
}

.project-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chevron-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.project-pill-btn[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

/* Project Dropdown Menu */
.project-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 290px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  display: none;
  animation: fadeInDown 0.15s ease-out;
}

.project-dropdown-menu.show {
  display: block;
}

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

.dropdown-header {
  padding: 8px 10px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--text-primary);
  text-align: left;
  transition: background-color 0.12s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-card-hover);
}

.dropdown-item.active {
  background-color: var(--teal-tint);
  color: var(--teal-500);
  font-weight: 600;
}

.item-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 6px 0;
}

.dropdown-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--teal-500);
  transition: background-color 0.12s ease;
}

.dropdown-action-btn:hover {
  background-color: var(--teal-tint);
}

/* Theme Toggle Button (Sun / Moon) */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}

.icon-btn:hover {
  color: var(--teal-500);
  border-color: var(--teal-500);
  background-color: var(--bg-card-hover);
}

.theme-icon {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .sun-icon {
  display: block;
}
[data-theme="dark"] .moon-icon {
  display: none;
}
[data-theme="light"] .sun-icon {
  display: none;
}
[data-theme="light"] .moon-icon {
  display: block;
}

/* ==========================================================================
   Navigation (Sticky Bottom - Mobile First)
   Blurred backdrop bar with 5 equally spaced icons
   Active tab glows Teal with small indicator dot underneath
   ========================================================================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: var(--nav-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--nav-border);
  z-index: 50;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.bottom-nav-inner {
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 0 8px;
}

.bottom-nav-item {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  position: relative;
  transition: color 0.18s ease, transform 0.15s ease;
}

.bottom-nav-item .bottom-icon {
  width: 22px;
  height: 22px;
  transition: stroke 0.18s ease, transform 0.18s ease;
}

.bottom-nav-item .bottom-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Active tab state */
.bottom-nav-item.active {
  color: var(--teal-500);
}

.bottom-nav-item.active .bottom-icon {
  stroke: var(--teal-500);
  transform: translateY(-1px);
  filter: drop-shadow(0 0 6px var(--teal-glow));
}

.indicator-dot {
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--teal-500);
  box-shadow: 0 0 8px var(--teal-500);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item.active .indicator-dot,
.nav-item.active .indicator-dot {
  opacity: 1;
  transform: scale(1);
}

/* Desktop sidebar is hidden by default on mobile / tablet */
.desktop-sidebar {
  display: none;
}

/* ==========================================================================
   VIEW 1: Search View (The Discovery Hub)
   ========================================================================== */
.search-box-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box-card:focus-within {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 8px 6px 16px;
  transition: border-color 0.18s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--teal-500);
}

.search-input-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input-field {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-primary);
  min-width: 0;
}

.search-input-field::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: all 0.15s ease;
}

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

.search-action-btn {
  background-color: var(--teal-500);
  color: var(--text-on-accent);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px var(--teal-glow);
}

.search-action-btn:hover {
  background-color: var(--teal-600);
  box-shadow: 0 4px 12px var(--teal-glow);
  transform: translateY(-1px);
}

/* Academic Sources Toggle & Quick Tags */
.search-filters-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.toggle-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  border-radius: 22px;
  transition: 0.25s ease;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: var(--teal-500);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.toggle-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.quick-tags-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-tag-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.quick-filter-tag {
  background-color: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.quick-filter-tag:hover {
  border-color: var(--teal-500);
  color: var(--teal-500);
  background-color: var(--teal-tint);
}

/* Empty State: Telescope Illustration */
.empty-state-container {
  text-align: center;
  padding: 60px 20px;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin-top: 10px;
}

.telescope-illustration-wrapper {
  margin: 0 auto 16px;
  max-width: 220px;
}

.telescope-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
}

/* Results Feed */
.results-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.results-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 6px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.results-count-text strong {
  color: var(--teal-500);
}

.results-sort-label {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Result Card */
.result-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card:hover {
  border-color: var(--teal-subtle-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.result-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.result-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  transition: color 0.15s ease;
}

.result-title:hover {
  color: var(--teal-500);
}

.result-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

.result-card-body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.result-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.source-url-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peer-reviewed-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: var(--teal-tint);
  color: var(--teal-500);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Save to Library Button (Teal Outline) */
.btn-save-library {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--teal-500);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--teal-500);
  background-color: transparent;
  transition: all 0.18s ease;
}

.btn-save-library:hover {
  background-color: var(--teal-500);
  color: var(--text-on-accent);
  box-shadow: 0 2px 8px var(--teal-glow);
}

.btn-save-library.saved {
  background-color: var(--teal-tint);
  border-color: var(--teal-500);
  color: var(--teal-500);
}

.btn-save-library.saved:hover {
  background-color: var(--teal-500);
  color: white;
}

/* ==========================================================================
   VIEW 2: Library View (The Evidence Vault)
   ========================================================================== */
.add-source-container {
  margin-bottom: 24px;
}

.add-source-trigger-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}

.add-source-trigger-btn:hover {
  border-color: var(--teal-500);
  background-color: var(--bg-card-hover);
}

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

.plus-icon-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--teal-500);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px var(--teal-glow);
  transition: transform 0.2s ease;
}

.add-source-trigger-btn[aria-expanded="true"] .plus-icon-pill {
  transform: rotate(45deg);
}

.trigger-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.trigger-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.add-source-trigger-btn[aria-expanded="true"] .trigger-chevron {
  transform: rotate(180deg);
}

/* Expanded Form Panel */
.add-source-panel {
  margin-top: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  animation: fadeInDown 0.2s ease-out;
}

.add-source-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label .required {
  color: #ef4444;
}

.form-input, .form-textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

/* Drag & Drop File Upload Area */
.file-dropzone {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  background-color: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-dropzone:hover, .file-dropzone.drag-active {
  border-color: var(--teal-500);
  background-color: var(--teal-tint);
}

.file-input-hidden {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon {
  color: var(--teal-500);
  margin-bottom: 8px;
}

.dropzone-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dropzone-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.file-preview-pill {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--teal-500);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--teal-500);
}

.file-preview-pill button {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
}

.file-preview-pill button:hover {
  color: #ef4444;
}

.form-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

/* Generic Button Styles */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--teal-500);
  color: var(--text-on-accent);
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--teal-glow);
  transition: all 0.18s ease;
}

.btn-primary:hover {
  background-color: var(--teal-600);
  box-shadow: 0 4px 14px var(--teal-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

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

/* Library Source List */
.source-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px;
}

.source-list-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.source-list-instruction {
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

/* Source List Item */
.source-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  cursor: pointer;
}

.source-item:hover {
  border-color: var(--teal-subtle-border);
  background-color: var(--bg-card-hover);
  transform: translateX(2px);
}

.source-item.active-preview {
  border-color: var(--teal-500);
  background-color: var(--teal-tint);
}

.source-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

/* [S1] Teal Badge */
.source-id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background-color: var(--teal-500);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 6px var(--teal-glow);
  flex-shrink: 0;
}

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

.source-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.source-item-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Trash Icon Button */
.btn-delete-source {
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-delete-source:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

/* Desktop Two-Column Layout (Defaults to single-column) */
.library-two-column-layout {
  display: block;
}

.desktop-preview-container {
  display: none;
}

/* ==========================================================================
   VIEW 3: Insights View (The Synthesis Engine)
   ========================================================================== */
/* The Trigger State (No analysis state) */
.insights-trigger-box {
  background-color: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.brain-icon-pulse-wrapper {
  margin: 0 auto 16px;
  display: inline-flex;
  padding: 16px;
  border-radius: 50%;
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  box-shadow: var(--shadow-glow);
  animation: pulseBrain 3s ease-in-out infinite;
}

@keyframes pulseBrain {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.trigger-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.trigger-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 24px;
}

.btn-generate-insights {
  padding: 12px 28px;
  font-size: 0.95rem;
}

/* Active Insights Content */
.insights-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Summary Box: Full-width, light-teal tinted box with 3-sentence synthesis */
.insights-summary-box {
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  border-left: 4px solid var(--teal-500);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.summary-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--teal-500);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-text-reanalyze {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--teal-500);
  transition: opacity 0.15s ease;
}

.btn-text-reanalyze:hover {
  text-decoration: underline;
}

.summary-text {
  font-size: 0.98rem;
  color: var(--text-primary);
  line-height: 1.7;
  font-weight: 400;
}

/* Key Points Section */
.insights-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.key-points-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.key-point-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.point-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--teal-500);
  margin-top: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--teal-glow);
}

.point-content {
  font-size: 0.94rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Citations in Brackets */
.citation-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

.citation-tag {
  display: inline-flex;
  align-items: center;
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  color: var(--teal-500);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  cursor: pointer;
}

.citation-tag:hover {
  background-color: var(--teal-500);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Visuals Grid: Theme Chart & Pattern / Conflict / Gap Cards */
.insights-visuals-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Theme Chart Card */
.chart-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.chart-card-header {
  margin-bottom: 18px;
}

.chart-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.horizontal-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.chart-value {
  font-weight: 700;
  color: var(--teal-500);
}

.chart-track {
  width: 100%;
  height: 9px;
  background-color: var(--bg-card-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.chart-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d9488, #14b8a6, #2dd4bf);
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Pattern, Conflict, Gap Cards */
.synthesis-cards-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analysis-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.analysis-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.analysis-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-teal {
  background-color: var(--pattern-badge-bg);
  color: var(--pattern-badge-text);
  border: 1px solid var(--pattern-border);
}

.badge-red {
  background-color: var(--conflict-badge-bg);
  color: var(--conflict-badge-text);
  border: 1px solid var(--conflict-border);
}

.badge-amber {
  background-color: var(--gap-badge-bg);
  color: var(--gap-badge-text);
  border: 1px solid var(--gap-border);
}

.sources-ref {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.analysis-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.analysis-card-text {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Card Specific Theming */
.card-pattern {
  background-color: var(--pattern-bg);
  border-color: var(--pattern-border);
  color: var(--pattern-text);
}
.card-pattern .analysis-card-title {
  color: var(--text-primary);
}

.card-conflict {
  background-color: var(--conflict-bg);
  border-color: var(--conflict-border);
  color: var(--conflict-text);
}
.card-conflict .analysis-card-title {
  color: var(--text-primary);
}

.card-gap {
  background-color: var(--gap-bg);
  border-color: var(--gap-border);
  color: var(--gap-text);
}
.card-gap .analysis-card-title {
  color: var(--text-primary);
}

.inline-citation-link {
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  color: inherit;
}

/* Footer Disclaimer */
.insights-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.82rem;
}

/* ==========================================================================
   VIEW 4: Chat View (Ask Your Sources)
   ========================================================================== */
.chat-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.chat-chips-scroll::-webkit-scrollbar {
  display: none;
}

.chat-prompt-chip {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chat-prompt-chip:hover {
  border-color: var(--teal-500);
  color: var(--teal-500);
  background-color: var(--teal-tint);
}

/* Chat Messages */
.chat-messages-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
  min-height: 380px;
}

.chat-message-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadeInView 0.2s ease-out;
}

.chat-message-row.user-message {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-bubble {
  max-width: 82%;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* User Bubble: Right-aligned, Teal */
.user-message .message-bubble {
  background-color: var(--teal-500);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px var(--teal-glow);
}

.user-message .sender-name {
  color: rgba(255, 255, 255, 0.8);
}

.user-message .message-time {
  color: rgba(255, 255, 255, 0.6);
}

/* AI Bubble: Left-aligned, Slate */
.ai-message .message-bubble {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
}

.sender-name {
  font-weight: 600;
  color: var(--text-secondary);
}

.message-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.bubble-body {
  font-size: 0.94rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble-footer {
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.citation-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Chat Citations Clickable Pills */
.chat-cite-pill {
  display: inline-flex;
  align-items: center;
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  color: var(--teal-500);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-cite-pill:hover {
  background-color: var(--teal-500);
  color: white;
}

/* Bottom-Fixed Chat Input */
.chat-input-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 8px 6px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.chat-input-bar:focus-within {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.chat-input-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.92rem;
  color: var(--text-primary);
  resize: none;
  max-height: 90px;
  line-height: 1.4;
  padding: 4px 0;
}

.chat-textarea::placeholder {
  color: var(--text-muted);
}

.btn-send-chat {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--teal-500);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--teal-glow);
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.btn-send-chat:hover {
  background-color: var(--teal-600);
  transform: scale(1.05);
}

/* ==========================================================================
   VIEW 5: Notes View (The Final Report)
   ========================================================================== */
.notes-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.notes-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Auto-save Pulse Checkmark */
.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.autosave-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--teal-500);
  box-shadow: 0 0 6px var(--teal-500);
  transition: background-color 0.2s ease;
}

.autosave-status.saving .autosave-pulse-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
  animation: pulseSaving 0.8s infinite;
}

@keyframes pulseSaving {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.autosave-status.saved .autosave-label {
  color: var(--teal-500);
}

/* Export Report Button & Dropdown */
.export-dropdown-wrapper {
  position: relative;
}

.btn-export-report {
  padding: 7px 16px;
}

.chevron-mini {
  margin-left: -2px;
}

.export-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  display: none;
  animation: fadeInDown 0.15s ease-out;
}

.export-dropdown-menu.show {
  display: block;
}

.export-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-align: left;
  transition: background-color 0.12s ease;
}

.export-menu-item:hover {
  background-color: var(--bg-card-hover);
  color: var(--teal-500);
}

.export-item-text {
  display: flex;
  flex-direction: column;
}

.export-item-title {
  font-size: 0.86rem;
  font-weight: 600;
}

.export-item-ext {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Notes Editor Card */
.notes-editor-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-btn {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.12s ease;
}

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

.toolbar-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-color);
  margin: 0 4px;
}

.toolbar-spacer {
  flex: 1;
}

.citation-inserter {
  color: var(--teal-500);
  background-color: var(--teal-tint);
  border-color: var(--teal-subtle-border);
}

.citation-inserter:hover {
  background-color: var(--teal-500);
  color: white;
}

.cite-badge-icon {
  font-size: 0.75rem;
  font-weight: 800;
  margin-right: 4px;
}

.mode-toggle-group {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 2px;
}

.toolbar-tab-btn {
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.toolbar-tab-btn.active {
  background-color: var(--teal-500);
  color: #ffffff;
}

/* Distraction-Free Text Area & Preview */
.editor-body-wrapper {
  position: relative;
  min-height: 480px;
  padding: 20px;
}

.notes-textarea {
  width: 100%;
  height: 100%;
  min-height: 440px;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.96rem;
  line-height: 1.7;
  resize: vertical;
}

.notes-preview-pane {
  min-height: 440px;
  font-size: 0.96rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.notes-preview-pane h1 {
  font-size: 1.6rem;
  margin-bottom: 16px;
  font-weight: 800;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.notes-preview-pane h2 {
  font-size: 1.25rem;
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--teal-500);
}

.notes-preview-pane p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.notes-preview-pane ol, .notes-preview-pane ul {
  padding-left: 24px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.notes-preview-pane li {
  margin-bottom: 8px;
}

.editor-footer-status {
  padding: 10px 18px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.md-support-label {
  margin-left: auto;
  font-weight: 500;
}

/* ==========================================================================
   Side Drawer (Mobile Preview & Tablet Preview)
   Mobile: Covers 90% of screen.
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 70;
  animation: fadeIn 0.2s ease;
}

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

.source-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 90%;
  max-width: 520px;
  background-color: var(--bg-surface-elevated);
  box-shadow: var(--shadow-drawer);
  z-index: 80;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

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

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

.drawer-badge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-badge-wrap .badge-teal {
  font-size: 0.85rem;
  padding: 2px 10px;
  font-weight: 700;
}

.drawer-meta-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drawer-close-btn {
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.drawer-url-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--teal-500);
  word-break: break-all;
}

.drawer-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drawer-text-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.drawer-claims-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-claim-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.claim-check {
  color: var(--teal-500);
  font-weight: 700;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-surface);
}

.drawer-footer button {
  flex: 1;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 84px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--teal-500);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUpToast 0.2s ease-out;
}

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

/* ==========================================================================
   DESKTOP RESPONSIVE BREAKPOINT (>= 1200px)
   - Bottom tab bar transforms into a Left Sidebar
   - Content expands to a two-column layout (e.g. Library left / Preview right)
   ========================================================================== */
@media (min-width: 1200px) {
  /* Hide Mobile Sticky Bottom Bar */
  .mobile-bottom-nav {
    display: none;
  }

  /* Show Desktop Left Sidebar */
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    z-index: 45;
    flex-shrink: 0;
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding: 0 8px;
  }

  .brand-logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--teal-500);
    text-shadow: 0 0 16px var(--teal-glow);
  }

  .brand-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    background-color: var(--teal-tint);
    border: 1px solid var(--teal-subtle-border);
    color: var(--teal-500);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
  }

  /* Sidebar Nav Links */
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    position: relative;
    transition: all 0.15s ease;
  }

  .nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .nav-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
  }

  .nav-item.active {
    color: var(--teal-500);
    background-color: var(--teal-tint);
    font-weight: 600;
    border: 1px solid var(--teal-subtle-border);
  }

  .nav-item .indicator-dot {
    position: static;
    margin-left: auto;
  }

  .source-count-pill {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
  }

  .nav-item.active .source-count-pill {
    background-color: var(--teal-500);
    color: #ffffff;
    border-color: var(--teal-500);
  }

  /* Sidebar Bottom Project Card */
  .sidebar-project-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-sm);
  }

  .project-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
  }

  .project-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--teal-500);
  }

  .project-scope-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }

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

  .project-stats-row {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* Hide header logo on desktop since sidebar has it */
  .header-left {
    visibility: hidden;
  }

  /* Main Column on desktop can be wider */
  .main-content-column {
    max-width: 1040px;
    padding: 32px 36px 60px 36px;
  }

  /* Two-column layout in Evidence Vault on Desktop */
  .library-two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
  }

  .desktop-preview-container {
    display: block;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    min-height: 480px;
    position: sticky;
    top: calc(var(--header-height) + 24px);
  }

  .desktop-preview-placeholder {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .desktop-preview-placeholder h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
  }

  .desktop-preview-placeholder p {
    font-size: 0.88rem;
    max-width: 320px;
  }

  /* Hide slide-out drawer on desktop when two-column is active */
  .source-drawer {
    display: none;
  }
  .drawer-backdrop {
    display: none !important;
  }
}

/* ==========================================================================
   Animations & Print Layout
   ========================================================================== */
.spin-animation {
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Base of the Interface: Team Attribution (Faith & Ayomide)
   ========================================================================== */
.app-interface-base {
  margin-top: 48px;
  padding: 16px 20px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.app-interface-base:hover {
  border-color: var(--teal-subtle-border);
  box-shadow: var(--shadow-md);
}

.interface-base-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-wrap: wrap;
  gap: 12px;
}

.team-credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.base-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--teal-500);
  box-shadow: 0 0 8px var(--teal-500);
  animation: pulseSaving 2s infinite;
}

.team-members-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.member-pill:hover {
  border-color: var(--teal-500);
  background-color: var(--teal-tint);
}

.member-icon {
  color: var(--teal-500);
  flex-shrink: 0;
}

.member-name {
  font-weight: 600;
  color: var(--text-primary);
}

.member-phone {
  color: var(--teal-500);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.member-phone:hover {
  text-decoration: underline;
  color: var(--teal-400);
}

.base-divider {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Sidebar team info */
.sidebar-team-info {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-team-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.team-tag {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.team-person {
  font-weight: 600;
  color: var(--text-secondary);
}

.team-phone-link {
  color: var(--teal-500);
  font-weight: 600;
  text-decoration: none;
}

.team-phone-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Interactive Add Mode Tabs & Input With Button
   ========================================================================== */
.add-tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  overflow-x: auto;
}

.add-mode-tab {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-card-hover);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.add-mode-tab:hover {
  color: var(--text-primary);
  border-color: var(--border-color);
}

.add-mode-tab.active {
  background-color: var(--teal-500);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--teal-glow);
}

.input-with-button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-button .form-input {
  flex: 1;
}

.field-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.resolved-source-preview {
  margin-top: 14px;
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  border-radius: var(--radius-md);
  padding: 14px;
  animation: fadeInDown 0.2s ease-out;
}

/* ==========================================================================
   Modals: Quote Verification Popover & Team Contact
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(6px);
  z-index: 120;
  animation: fadeIn 0.18s ease;
}

.quote-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 580px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-drawer);
  z-index: 130;
  overflow: hidden;
  animation: zoomInModal 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomInModal {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

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

.modal-badge-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.verified-shield-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  color: var(--teal-500);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.modal-close-btn {
  font-size: 1.4rem;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}

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

.quote-modal-body {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.quote-modal-source-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.quote-box {
  background-color: var(--bg-card);
  border: 1px solid var(--teal-subtle-border);
  border-left: 4px solid var(--teal-500);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  position: relative;
}

.quote-mark {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--teal-500);
  opacity: 0.4;
  font-family: Georgia, serif;
  position: absolute;
  top: 8px;
  left: 8px;
}

.exact-quote-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.65;
  font-style: italic;
  padding-left: 18px;
}

.quote-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

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

.meta-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.meta-val {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.meta-link {
  font-size: 0.84rem;
  color: var(--teal-500);
  font-weight: 600;
}

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

.quote-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  display: flex;
  justify-content: flex-end;
}

.quote-modal-footer button {
  width: 100%;
}

/* Team contact card in modal */
.team-contact-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.team-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.team-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-copy-num {
  padding: 8px 14px;
  font-size: 0.84rem;
}

/* ==========================================================================
   Interactive Enhancements: Sample Pills, Vault Search, Tabs & Modals
   ========================================================================== */
.btn-sample-fill {
  background: transparent;
  border: 1px dashed var(--teal-500);
  color: var(--teal-500);
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-sample-fill:hover {
  background: var(--teal-tint);
  border-style: solid;
}

.sample-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.sample-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sample-pill-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.sample-pill-btn:hover {
  border-color: var(--teal-500);
  color: var(--teal-500);
  background-color: var(--teal-tint);
  transform: translateY(-1px);
}

/* Vault Real-time Search & Filter Bar */
.vault-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.vault-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.vault-search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.vault-search-input {
  width: 100%;
  padding: 9px 36px 9px 38px;
  font-size: 0.88rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.vault-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--teal-tint);
}

.vault-clear-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.vault-clear-btn:hover {
  color: var(--text-primary);
}

.vault-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.vault-filter-chip {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.vault-filter-chip:hover {
  border-color: var(--teal-500);
  color: var(--teal-500);
}

.vault-filter-chip.active {
  background-color: var(--teal-500);
  border-color: var(--teal-500);
  color: #ffffff;
  font-weight: 600;
}

/* Source Card Quick Actions */
.source-item {
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.source-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.source-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.btn-copy-cite {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--teal-500);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-copy-cite:hover {
  background: var(--teal-tint);
  border-color: var(--teal-500);
}

/* Insights Category Filter Tabs */
.insights-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.insights-filter-tab {
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.insights-filter-tab:hover {
  border-color: var(--teal-500);
  color: var(--teal-500);
}

.insights-filter-tab.active {
  background-color: var(--teal-500);
  border-color: var(--teal-500);
  color: #ffffff;
}

/* Conflict & Gap Interactive Buttons */
.btn-conflict-action,
.btn-gap-action {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-conflict-action {
  background-color: var(--conflict-badge-bg);
  border: 1px solid var(--conflict-border);
  color: var(--conflict-text);
}

.btn-conflict-action:hover {
  background-color: var(--conflict-border);
  transform: translateY(-1px);
}

.btn-gap-action {
  background-color: var(--gap-badge-bg);
  border: 1px solid var(--gap-border);
  color: var(--gap-text);
}

.btn-gap-action:hover {
  background-color: var(--gap-border);
  transform: translateY(-1px);
}

/* Side-by-Side Conflict Comparison Modal */
.conflict-compare-modal {
  max-width: 820px !important;
  width: 94%;
}

.conflict-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .conflict-grid-2col {
    grid-template-columns: 1fr;
  }
}

.conflict-col {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.conflict-col.col-s2 {
  border-left: 4px solid var(--conflict-badge-text);
}

.conflict-col.col-s4 {
  border-left: 4px solid var(--teal-500);
}

.conflict-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.conflict-col-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background-color: var(--conflict-badge-bg);
  color: var(--conflict-badge-text);
  border: 1px solid var(--conflict-border);
}

.conflict-paper-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.conflict-journal {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.conflict-quote-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  margin-bottom: 12px;
  font-style: italic;
  flex: 1;
}

.conflict-metric-pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  text-align: center;
}

.conflict-metric-pill.negative {
  background-color: var(--conflict-badge-bg);
  color: var(--conflict-badge-text);
  border: 1px solid var(--conflict-border);
}

.conflict-metric-pill.positive {
  background-color: var(--teal-tint);
  color: var(--teal-500);
  border: 1px solid var(--teal-subtle-border);
}

.conflict-reconciliation-box {
  background-color: var(--teal-tint);
  border: 1px solid var(--teal-subtle-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Citation Inserter Dialog */
.citation-picker-dialog {
  max-width: 580px !important;
  width: 90%;
}

.citation-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.citation-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.citation-picker-item:hover {
  border-color: var(--teal-500);
  background-color: var(--teal-tint);
  transform: translateX(3px);
}

.citation-picker-item .source-id-badge {
  flex-shrink: 0;
}

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

.citation-picker-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.citation-picker-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}


@media print {
  /* Clean print view for report export */
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .main-header,
  .desktop-sidebar,
  .mobile-bottom-nav,
  .notes-header-actions,
  .editor-toolbar,
  .editor-footer-status,
  .drawer-backdrop,
  .source-drawer,
  .toast-container {
    display: none !important;
  }
  .main-content-column {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .notes-editor-card {
    border: none !important;
    box-shadow: none !important;
  }
  .notes-textarea {
    display: none !important;
  }
  .notes-preview-pane {
    display: block !important;
  }
}

