/* ═══════════════════════════════════════════════════════════════
   Journal Finder – Custom Styles
   Bootstrap 5.3 dark theme base + custom overrides
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────────────────── */
:root {
  --bg-page:    #0d1117;
  --bg-surface: #161b22;
  --bg-card:    #1c2029;
  --bg-input:   #0d1117;
  --bg-hover:   rgba(139,148,158,.08);
  --border:     rgba(240,246,252,.1);
  --border-faint: rgba(240,246,252,.06);

  --accent:      #6366f1;
  --accent-glow: rgba(99,102,241,.25);
  --accent-text: #818cf8;

  --text-primary: #c9d1d9;
  --text-muted:   #8b949e;
  --text-subtle:  #6e7681;

  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #60a5fa;

  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 150ms ease;
  --shadow-lg:  0 8px 32px rgba(0,0,0,.5);

  /* Bootstrap overrides */
  --bs-body-bg:    var(--bg-page);
  --bs-body-color: var(--text-primary);
  --bs-border-color: var(--border);
  --bs-link-color: var(--accent-text);
  --bs-link-hover-color: #a5b4fc;
}

/* ── Base reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,148,158,.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,148,158,.5); }

/* ── Header ──────────────────────────────────────────────────── */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.app-header .brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.app-header .brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.app-header .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: -1px;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 20px;
  font-size: 11px;
  color: var(--accent-text);
  font-weight: 500;
}

/* ── Layout ──────────────────────────────────────────────────── */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.app-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  width: fit-content;
  margin-bottom: 20px;
}

.app-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
}

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

.app-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  font-weight: 600;
}
.app-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.app-tab-btn svg { width: 15px; height: 15px; }

.tab-badge {
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  line-height: 1.5;
}

.tab-badge-beta {
  background: rgba(99,102,241,.15);
  color: var(--accent-text);
  border: 1px solid rgba(99,102,241,.25);
}

.tab-badge-soon {
  background: rgba(245,158,11,.12);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,.25);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Cards ───────────────────────────────────────────────────── */
.card-surface {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-metric {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color var(--transition);
}

.card-metric:hover { border-color: rgba(99,102,241,.3); }

.card-metric .metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 500;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-metric .metric-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.card-metric .metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-label-custom {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.65;
  resize: vertical;
  min-height: 150px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}

.form-textarea:focus {
  border-color: rgba(99,102,241,.5);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 9px 14px 9px 36px;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  font-family: inherit;
}

.form-input:focus {
  border-color: rgba(99,102,241,.5);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-subtle); }

.input-wrapper { position: relative; }
.input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 15px;
  height: 15px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  letter-spacing: .2px;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
}

.btn-primary-custom:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 6px 20px rgba(99,102,241,.5);
  transform: translateY(-1px);
}
.btn-primary-custom:active:not(:disabled) { transform: scale(.99) translateY(0); }
.btn-primary-custom:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-ghost-sm:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(139,148,158,.25);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

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

/* ── Progress bar ────────────────────────────────────────────── */
.progress-section {
  display: none;
  margin-top: 12px;
}

.progress-section.visible { display: block; }

.progress-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 2px;
  animation: progressAnim 2s ease-in-out infinite;
  transform-origin: left;
}

@keyframes progressAnim {
  0%   { width: 0%; }
  50%  { width: 80%; }
  100% { width: 95%; }
}

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Stats bar ───────────────────────────────────────────────── */
.results-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.results-stats-bar strong { color: var(--text-primary); font-size: 14px; }

.results-chip {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Filters panel ───────────────────────────────────────────── */
/* ── Filters header ─────────────────────────────────────────── */
.filters-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.filters-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.filters-toggle.has-active {
  border-color: rgba(99,102,241,.5);
  color: var(--accent-text);
  background: rgba(99,102,241,.08);
}

/* ── Filters panel ───────────────────────────────────────────── */
.filters-panel {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 2px solid rgba(99,102,241,.3);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.filters-panel:not(.open) { display: none; }
.filters-panel.open { display: flex; }

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.filter-group-hidden { display: none; }

.filter-group-inline {
  padding-top: 2px;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.filter-hint {
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-subtle);
  margin-left: 2px;
}

.filter-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text-muted);
  user-select: none;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-chip:hover {
  border-color: rgba(139,148,158,.4);
  color: var(--text-primary);
  background: var(--bg-hover);
}
.filter-chip.active {
  background: rgba(99,102,241,.16);
  border-color: rgba(99,102,241,.5);
  color: var(--accent-text);
  font-weight: 600;
}
.fchip-q1.active { background: rgba(34,197,94,.15);  border-color: rgba(34,197,94,.5);  color: #4ade80; }
.fchip-q2.active { background: rgba(59,130,246,.15); border-color: rgba(59,130,246,.5); color: #60a5fa; }
.fchip-q3.active { background: rgba(234,179,8,.15);  border-color: rgba(234,179,8,.5);  color: #facc15; }
.fchip-q4.active { background: rgba(239,68,68,.15);  border-color: rgba(239,68,68,.5);  color: #f87171; }
.fchip-pts-hi.active { background: rgba(168,85,247,.15); border-color: rgba(168,85,247,.5); color: #c084fc; }
.fchip-free.active   { background: rgba(34,197,94,.15);  border-color: rgba(34,197,94,.5);  color: #4ade80; }

.chip-hint {
  font-size: 9px;
  opacity: .7;
  font-weight: 400;
}

.filter-cats-wrap {
  max-height: 120px;
  overflow-y: auto;
}

/* Toggle switch */
.filter-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.filter-toggle-label input[type="checkbox"] {
  display: none;
}
.filter-toggle-track {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  flex-shrink: 0;
  transition: var(--transition);
}
.filter-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--text-subtle);
  border-radius: 50%;
  transition: var(--transition);
}
.filter-toggle-label input:checked + .filter-toggle-track {
  background: rgba(99,102,241,.25);
  border-color: rgba(99,102,241,.5);
}
.filter-toggle-label input:checked + .filter-toggle-track::after {
  left: 16px;
  background: var(--accent-text);
}
.filter-toggle-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Pricing legend */
.filter-pricing-legend {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 12px;
  background: rgba(99,102,241,.05);
  border: 1px solid rgba(99,102,241,.15);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-subtle);
  line-height: 1.55;
}
.filter-pricing-legend strong { color: var(--text-muted); }
.filter-pricing-legend em { font-style: normal; color: var(--text-primary); }

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 2px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.filter-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: rgba(99,102,241,.5); }

/* ── Table ───────────────────────────────────────────────────── */
.results-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-faint);
  background: var(--bg-card);
}

.toolbar-left {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.toolbar-right {
  position: relative;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.results-table thead th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 11px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.results-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

.results-table thead th.sortable:hover {
  color: var(--text-primary);
  background: rgba(139,148,158,.05);
}

.results-table thead th.sorted-asc,
.results-table thead th.sorted-desc {
  color: var(--accent-text);
}

.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: .5;
}

.results-table tbody tr.journal-row {
  border-bottom: 1px solid var(--border-faint);
  transition: background var(--transition);
}

.results-table tbody tr.journal-row:nth-child(4n+1),
.results-table tbody tr.journal-row:nth-child(4n+2) {
  background: rgba(255,255,255,.012);
}

.results-table tbody tr.journal-row:hover {
  background: rgba(99,102,241,.07);
}

.results-table tbody tr.journal-row.expanded {
  background: rgba(99,102,241,.06);
}

.results-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.results-table td.td-title {
  min-width: 240px;
  max-width: 400px;
}

.journal-title-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  display: block;
  line-height: 1.4;
  font-size: 14px;
  transition: color var(--transition);
}

.journal-title-link:hover { color: var(--accent-text); text-decoration: underline; text-decoration-color: rgba(129,140,248,.4); }

.journal-meta {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.journal-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
}

/* ── Expanded row ────────────────────────────────────────────── */
.expanded-row { display: none; }
.expanded-row.open { display: table-row; }

.expanded-content {
  padding: 16px 20px;
  background: rgba(99,102,241,.03);
  border-top: 1px solid rgba(99,102,241,.1);
  border-bottom: 1px solid var(--border-faint);
}

.expanded-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px 20px;
  margin-bottom: 14px;
}

.expanded-field label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-subtle);
  margin-bottom: 4px;
  display: block;
}

.expanded-field span {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* ── Match score bar ─────────────────────────────────────────── */
.match-score-cell {
  min-width: 72px;
  width: 72px;
}

.match-score-val {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

.match-bar {
  height: 3px;
  border-radius: 2px;
  background: var(--border-faint);
  overflow: hidden;
  width: 52px;
}

.match-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .4s ease;
}

/* Score color thresholds */
.score-high  { color: #4ade80; }
.score-mid   { color: #a3e635; }
.score-low   { color: #fbbf24; }
.score-poor  { color: #f87171; }

.bar-high  { background: linear-gradient(90deg, #16a34a, #4ade80); box-shadow: 0 0 6px rgba(74,222,128,.4); }
.bar-mid   { background: linear-gradient(90deg, #65a30d, #a3e635); }
.bar-low   { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar-poor  { background: linear-gradient(90deg, #dc2626, #f87171); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-q1 { background: rgba(34,197,94,.15);  color: #4ade80; border-color: rgba(34,197,94,.35);  font-size: 12px; font-weight: 700; padding: 3px 10px; }
.badge-q2 { background: rgba(96,165,250,.15);  color: #93c5fd; border-color: rgba(96,165,250,.35); font-size: 12px; font-weight: 700; padding: 3px 10px; }
.badge-q3 { background: rgba(251,191,36,.15);  color: #fcd34d; border-color: rgba(251,191,36,.35); font-size: 12px; font-weight: 700; padding: 3px 10px; }
.badge-q4 { background: rgba(239,68,68,.15);   color: #fca5a5; border-color: rgba(239,68,68,.35);  font-size: 12px; font-weight: 700; padding: 3px 10px; }
.badge-oa      { background: rgba(34,197,94,.12);  color: #4ade80; border-color: rgba(34,197,94,.3);   font-size: 11px; font-weight: 600; padding: 3px 9px; }
.badge-oa-paid { background: rgba(251,191,36,.10); color: #fbbf24; border-color: rgba(251,191,36,.3);  font-size: 11px; font-weight: 600; padding: 3px 9px; }
.badge-sub     { background: rgba(139,148,158,.1); color: var(--text-muted); border-color: rgba(139,148,158,.25); font-size: 11px; padding: 3px 9px; }
.badge-cat { background: rgba(99,102,241,.08); color: var(--accent-text); border-color: rgba(99,102,241,.2); font-size: 11px; font-weight: 500; }

.null-val {
  color: var(--border);
  font-style: normal;
  font-size: 13px;
  letter-spacing: .05em;
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  border-top: 1px solid var(--border);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

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

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Footer ──────────────────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  margin-top: auto;
}

.footer-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 1440px;
  margin: 0 auto;
}

.footer-stat {
  display: flex;
  align-items: center;
  gap: 5px;
}

.footer-stat strong { color: var(--text-primary); font-weight: 600; }

/* ── Empty / Error states ────────────────────────────────────── */
.state-box {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.state-box svg {
  width: 40px;
  height: 40px;
  opacity: .3;
  margin-bottom: 12px;
}

.state-box h4 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.state-box p {
  font-size: 12px;
  color: var(--text-subtle);
  max-width: 340px;
  margin: 0 auto;
}

.error-alert {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: #fca5a5;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
}

.info-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(99,102,241,.05);
  border: 1px solid rgba(99,102,241,.15);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.info-hint-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.hint-chip {
  padding: 2px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: ui-monospace, 'Cascadia Code', monospace;
}

/* ── Skeleton loaders ────────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    rgba(255,255,255,.04) 50%,
    var(--bg-card) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-h { height: 14px; }
.skeleton-sm { height: 10px; }
.skeleton-lg { height: 20px; }

/* ── Similar articles table ──────────────────────────────────── */
.article-title-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.35;
  transition: color var(--transition);
}

.article-title-link:hover { color: var(--accent-text); }

.article-authors {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.doi-link {
  font-size: 10px;
  color: var(--text-subtle);
  text-decoration: none;
  font-family: ui-monospace, monospace;
  transition: color var(--transition);
}

.doi-link:hover { color: var(--accent-text); }

/* ── Mode toggle (Quick / Wide) ──────────────────────────────── */
.mode-toggle {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.mode-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.mode-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* ── Research Booster tab ────────────────────────────────────── */
.booster-coming-soon {
  text-align: center;
  padding: 60px 20px;
}

.booster-log {
  font-family: ui-monospace, 'Cascadia Code', 'Courier New', monospace;
  font-size: 11px;
  color: var(--success);
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(34,197,94,.15);
  border-radius: 6px;
  padding: 14px;
  height: 120px;
  overflow: hidden;
  text-align: left;
  line-height: 1.7;
}

/* ── Journal detail (journal.html) ───────────────────────────── */
.detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  padding: 5px 0;
  transition: color var(--transition);
}

.detail-back-btn:hover { color: var(--text-primary); }

.detail-title { font-size: 22px; font-weight: 700; letter-spacing: -.4px; line-height: 1.25; }

.detail-section-heading {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-subtle);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-dl dt {
  font-size: 11px;
  color: var(--text-muted);
}

.detail-dl dd {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Spinner ─────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 16px 12px; }

  .app-tabs {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-tab-btn .tab-text { display: none; }

  .results-table { font-size: 12px; }
  .results-table td { padding: 8px 8px; }

  .filter-row { grid-template-columns: 1fr 1fr; }
  .detail-title { font-size: 18px; }
}

@media (max-width: 480px) {
  .filter-row { grid-template-columns: 1fr; }
}

/* ── Column visibility toggle ────────────────────────────────── */
.col-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}

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

.col-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 0;
  min-width: 180px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}

.col-menu.open { display: block; }

.col-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

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

.col-menu-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
}

/* ── Toast notification ──────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .2s ease;
  max-width: 320px;
}

.toast.success { border-color: rgba(34,197,94,.3); }
.toast.error   { border-color: rgba(239,68,68,.3); }

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

/* ── Similar-source badge (match tab enrichment) ─────────────── */
.badge-similar-source {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.3);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: help;
}
.badge-similar-source::before { content: "✓ "; }

/* ── Tag input (Search tab) ──────────────────────────────────── */
.tag-input-wrap {
  position: relative;
}

.tag-input-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: text;
  transition: border-color var(--transition);
}

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

.tag-chip-input {
  flex: 1;
  min-width: 160px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 2px 0;
  line-height: 1.4;
}

.tag-chip-input::placeholder { color: var(--text-subtle); }

/* individual tag pill */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.tag-pill-category { background: rgba(99,102,241,.2); color: #a5b4fc; border: 1px solid rgba(99,102,241,.35); }
.tag-pill-publisher { background: rgba(96,165,250,.18); color: #93c5fd; border: 1px solid rgba(96,165,250,.3); }
.tag-pill-country   { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.tag-pill-quartile  { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.tag-pill-access    { background: rgba(239,68,68,.13);  color: #f87171; border: 1px solid rgba(239,68,68,.28); }
.tag-pill-text      { background: rgba(139,148,158,.12); color: var(--text-muted); border: 1px solid var(--border); }

.tag-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 10px;
  color: inherit;
  flex-shrink: 0;
  line-height: 1;
  transition: background var(--transition);
}
.tag-pill-remove:hover { background: rgba(255,255,255,.25); }

/* type label inside pill */
.tag-pill-type {
  font-size: 10px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* autocomplete dropdown */
.tag-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 200;
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
}

.tag-dropdown-section {
  padding: 6px 0;
}

.tag-dropdown-label {
  padding: 4px 12px 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-subtle);
}

.tag-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.tag-dropdown-item:hover,
.tag-dropdown-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tag-dropdown-item .item-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.tag-dropdown-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 13px;
}

.tag-dropdown-divider {
  height: 1px;
  background: var(--border-faint);
  margin: 4px 0;
}

/* quick-pick row */
.tag-quickpick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-quickpick-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-quickpick-label {
  font-size: 11px;
  color: var(--text-subtle);
  white-space: nowrap;
}

.quick-tag-btn {
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.quick-tag-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(240,246,252,.2);
}

.quick-tag-btn.active {
  background: rgba(99,102,241,.2);
  color: #a5b4fc;
  border-color: rgba(99,102,241,.4);
}

/* ── Dual pricing display ────────────────────────────────────── */
/* OA type + cost columns */
.access-type    { font-size: 12px; font-weight: 700; white-space: nowrap; }
.access-oa      { color: #4ade80; }
.access-hybrid  { color: #fbbf24; }
.access-sub     { color: var(--text-muted); font-weight: 500; }
.cost-free      { font-size: 12px; color: #4ade80; font-weight: 600; }
.cost-paid      { font-size: 12px; font-weight: 700; color: var(--text-primary); font-family: ui-monospace,'Cascadia Code',monospace; }
.cost-hybrid    { display: flex; flex-direction: column; gap: 4px; }
.cost-row2      { display: flex; flex-direction: row; align-items: baseline; gap: 4px; white-space: nowrap; }
.cost-tag       { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cost-tag-oa    { color: #4ade80; }
.cost-tag-sub   { color: var(--text-subtle); }
.cost-amt       { font-size: 12px; font-weight: 700; color: var(--text-primary); font-family: ui-monospace,'Cascadia Code',monospace; white-space: nowrap; }

.price-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
}

.price-cell > * {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.price-label-oa {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 0px 4px;
  border-radius: 3px;
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.25);
  line-height: 1.6;
  letter-spacing: .04em;
}

.price-label-sub {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 0px 4px;
  border-radius: 3px;
  background: rgba(139,148,158,.12);
  color: var(--text-subtle);
  border: 1px solid var(--border-faint);
  line-height: 1.6;
  letter-spacing: .04em;
}

.author-free {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #4ade80;
  font-weight: 700;
  font-size: 12px;
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.3);
  border-radius: 10px;
  padding: 2px 9px;
  white-space: nowrap;
  letter-spacing: .01em;
}

.author-cost-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.price-free {
  color: #4ade80;
  font-weight: 600;
  font-size: 11px;
}

.price-val {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 11px;
  color: var(--text-primary);
}

/* Journal detail pricing rows */
.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
}
.detail-price-label { font-size: 11px; font-weight: 700; min-width: 32px; }
.detail-price-val   { font-size: 14px; color: var(--text-primary); }
.dpl-oa  { color: #4ade80; }
.dpl-sub { color: var(--text-subtle); }

.price-label-oa-lg {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.25);
  letter-spacing: .04em;
  min-width: 32px;
  text-align: center;
}

.price-label-sub-lg {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(139,148,158,.12);
  color: var(--text-subtle);
  border: 1px solid var(--border-faint);
  letter-spacing: .04em;
  min-width: 32px;
  text-align: center;
}

.price-free-detail {
  color: #4ade80;
  font-weight: 600;
  font-size: 13px;
}

/* ── Enrich (Aktualizuj dane) modal ──────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  width: 100%;
  max-width: 420px;
  margin: 16px;
  overflow: hidden;
  animation: modalIn .18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
  flex-shrink: 0;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.55;
}

.modal-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
}

.modal-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  display: block;
}

.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-faint);
}

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition), background var(--transition);
}

.btn-primary-sm:hover:not(:disabled) { background: #4f52e0; }
.btn-primary-sm:disabled { opacity: .5; cursor: not-allowed; }

/* Result message inside modal */
.enrich-result {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-top: 12px;
}

.enrich-success {
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.25);
  color: #4ade80;
}

.enrich-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.25);
  color: #fca5a5;
}

/* ── Journal detail — metric value accent colors ─────────────── */
.metric-value-accent { color: var(--accent-text); }
.metric-value-success { color: var(--success); }
.metric-value-warning { color: var(--warning); }
.metric-value-danger  { color: var(--danger); }

/* Card metric hover glow */
.card-metric { cursor: default; }
.card-metric:hover {
  border-color: rgba(99,102,241,.2);
  box-shadow: 0 2px 12px rgba(99,102,241,.08);
}

/* Improve journal detail title responsiveness */
@media (max-width: 600px) {
  .detail-title { font-size: 18px; }
  .card-metric .metric-value { font-size: 18px; }
}

/* Improve filter panel on mobile */
@media (max-width: 600px) {
  .filter-row { grid-template-columns: 1fr; }
  .filter-chip { font-size: 12px; padding: 5px 12px; }
}

