/* AllScience — Profile Page */

/* ================================================================
   CSS Custom Properties for theme support
   ================================================================ */
:root {
  --pf-bg: var(--color-bg, #0b1120);
  --pf-bg-secondary: var(--color-bg-secondary, #111827);
  --pf-bg-card: var(--color-bg-card, #1a2233);
  --pf-border: var(--color-border, #1e293b);
  --pf-text: var(--color-text, #e2e8f0);
  --pf-text-muted: var(--color-text-muted, #8896ab);
  --pf-text-dim: var(--color-text-dim, #5a6a80);
  --pf-primary: var(--color-primary, #3b82f6);
  --pf-accent: var(--color-accent, #06d6a0);
}

/* Light theme overrides */
[data-theme="light"] {
  --pf-bg: var(--color-bg, #ffffff);
  --pf-bg-secondary: #f1f5f9;
  --pf-bg-card: #ffffff;
  --pf-border: #e2e8f0;
  --pf-text: #1e293b;
  --pf-text-muted: #475569;
  --pf-text-dim: #64748b;
  --pf-primary: var(--color-primary, #3b82f6);
  --pf-accent: var(--color-accent, #059669);
}
[data-theme="light"] .profile-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
[data-theme="light"] .profile-stat {
  background: #ffffff;
  border-color: #e2e8f0;
}
[data-theme="light"] .profile-name {
  color: #0f172a;
}
[data-theme="light"] .profile-username {
  color: #475569;
}

/* ================================================================
   Fade-in on scroll animation
   ================================================================ */
.pf-fade-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.pf-fade-section.pf-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================================
   Profile layout (existing — edit page)
   ================================================================ */
.profile-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  margin-bottom: 4rem;
}

.profile-card {
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
  padding: 2rem;
}

.profile-avatar-wrap {
  position: relative;
  width: 80px;
  margin: 0 auto 1.5rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pf-primary), var(--pf-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pf-bg-card);
  border: 2px solid var(--pf-border);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.avatar-upload-btn:hover {
  background: var(--pf-primary);
}

.profile-name {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.profile-institution {
  text-align: center;
  font-size: 0.875rem;
  color: var(--pf-text-muted);
  margin-bottom: 1rem;
}

.profile-bio {
  font-size: 0.875rem;
  color: var(--pf-text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  text-align: center;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--pf-text-dim);
}

.profile-meta-item a {
  color: var(--pf-primary);
  text-decoration: none;
}

.profile-meta-item a:hover { text-decoration: underline; }

.meta-icon { font-size: 0.875rem; }

.visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  font-size: 0.8125rem;
}
.visibility-toggle input[type="checkbox"] {
  accent-color: var(--pf-primary);
}
.visibility-label { color: var(--pf-text-dim); }

/* ================================================================
   Research Interests — styled tag pills
   ================================================================ */
.profile-interests {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin-bottom: 1.5rem;
}

.profile-interests--portfolio {
  gap: 0.5rem;
  justify-content: flex-start;
  margin-bottom: 2rem;
}

.profile-interest {
  padding: 0.125rem 0.625rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 100px;
  font-size: 0.6875rem;
  color: #93bbfc;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.profile-interest--pill {
  padding: 0.375rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 100px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
  color: var(--pf-primary);
  cursor: default;
}

.profile-interest--pill:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

[data-theme="light"] .profile-interest {
  color: #2563eb;
}
[data-theme="light"] .profile-interest--pill {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.15);
}

.profile-actions {
  display: flex;
  gap: 0.75rem;
}

.profile-actions .btn { flex: 1; }

.profile-right {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Quick stats */
.profile-activity h3 { margin-bottom: 1rem; }
.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.profile-stat {
  text-align: center;
  padding: 1rem;
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
}
.profile-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--pf-primary);
}
.profile-stat-label {
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Publications list */
.profile-publications h3 {
  margin-bottom: 1.5rem;
}

.profile-pub-card {
  display: block;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.profile-pub-card:hover { border-color: var(--pf-primary); }

.profile-pub-title {
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.profile-pub-meta {
  font-size: 0.75rem;
  color: var(--pf-text-dim);
}

/* ================================================================
   Public portfolio (read-only view) — Header
   ================================================================ */
.portfolio-header {
  text-align: center;
  padding: 3rem 0 2rem;
}

.portfolio-name {
  font-size: 2rem;
  font-weight: 800;
}

.portfolio-institution {
  font-size: 1rem;
  color: var(--pf-text-muted);
  margin-top: 0.25rem;
}

/* Portfolio stats row (header) */
.portfolio-stats {
  display: flex; justify-content: center; gap: 2rem;
  margin: 1.5rem 0;
}
.portfolio-stat { text-align: center; }
.stat-num { display: block; font-size: 1.5rem; font-weight: 800; color: var(--pf-text); }
.stat-label { font-size: 0.6875rem; color: var(--pf-text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

.portfolio-bio {
  max-width: 600px; margin: 0 auto 1.5rem; text-align: center;
  color: var(--pf-text-muted); line-height: 1.7; font-size: 0.9375rem;
}
.portfolio-links {
  text-align: center; margin-bottom: 1.5rem;
  font-size: 0.8125rem; color: var(--pf-text-dim);
}
.portfolio-section-title {
  margin: 2.5rem 0 1.25rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--pf-border);
  font-size: 1.125rem;
}

.portfolio-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--pf-border);
}

.portfolio-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* ================================================================
   Section navigation tabs
   ================================================================ */
.portfolio-nav {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin: 2rem 0 1.5rem;
  padding: 0.25rem;
  background: var(--pf-bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--pf-border);
  flex-wrap: wrap;
}
.portfolio-nav-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--pf-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.portfolio-nav-btn:hover {
  color: var(--pf-text);
  background: rgba(255,255,255,0.05);
}
[data-theme="light"] .portfolio-nav-btn:hover {
  background: rgba(0,0,0,0.04);
}
.portfolio-nav-btn.active {
  background: var(--pf-primary);
  color: #fff;
}

/* ================================================================
   Impact stats cards (animated counters)
   ================================================================ */
.impact-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.impact-stats-grid--wide {
  max-width: 100%;
}
.impact-stat-card {
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.impact-stat-card:hover {
  border-color: var(--pf-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
}
.impact-stat-card--animated .impact-stat-value {
  font-variant-numeric: tabular-nums;
}
.impact-stat-icon {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--pf-primary);
}
.impact-stat-icon svg {
  stroke: var(--pf-primary);
}
.impact-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--pf-text);
  line-height: 1.2;
}
.impact-stat-label {
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}
.impact-stat-detail {
  font-size: 0.75rem;
  color: var(--pf-text-muted);
  margin-top: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
   Featured Publications (larger cards grid)
   ================================================================ */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.featured-card {
  display: block;
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.featured-card:first-child {
  border-color: rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.04), rgba(6, 214, 160, 0.02));
}
.featured-card:hover {
  border-color: var(--pf-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
}

.portfolio-featured {
  margin-bottom: 2rem;
}

.featured-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--pf-primary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.featured-card-type {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pf-primary);
  margin-bottom: 0.5rem;
}

.featured-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--pf-text);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.featured-card-abstract {
  font-size: 0.8125rem;
  color: var(--pf-text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
  flex-wrap: wrap;
}

/* ================================================================
   Contact section
   ================================================================ */
.portfolio-contact {
  margin-bottom: 1rem;
}
.contact-items {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
}
.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--pf-text-muted);
}
.contact-item a {
  color: var(--pf-primary);
  text-decoration: none;
}
.contact-item a:hover {
  text-decoration: underline;
}
.contact-item svg {
  stroke: var(--pf-text-dim);
  flex-shrink: 0;
}

/* ================================================================
   Co-author network
   ================================================================ */
.coauthor-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.coauthor-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  transition: border-color 0.2s, transform 0.15s;
}
.coauthor-card:hover {
  border-color: var(--pf-primary);
  transform: translateY(-1px);
}
.coauthor-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pf-primary), var(--pf-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.coauthor-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.coauthor-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pf-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.coauthor-name:hover {
  color: var(--pf-primary);
  text-decoration: underline;
}
.coauthor-collab {
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
}
.coauthor-inst {
  font-size: 0.6875rem;
  color: var(--pf-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
   Publication timeline
   ================================================================ */
.timeline-wrap {
  position: relative;
  padding: 1rem 0 2rem;
}
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--pf-border);
  transform: translateX(-50%);
}
.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: 2rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item.tl-left .tl-card { margin-right: calc(50% + 1.5rem); margin-left: 0; text-align: right; }
.timeline-item.tl-right .tl-card { margin-left: calc(50% + 1.5rem); margin-right: 0; text-align: left; }
.tl-dot {
  position: absolute;
  left: 50%;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pf-primary);
  border: 2px solid var(--pf-bg);
  transform: translateX(-50%);
  z-index: 1;
  transition: transform 0.2s;
}
.tl-dot.tl-dot-book {
  background: var(--pf-accent);
}
.timeline-item:hover .tl-dot {
  transform: translateX(-50%) scale(1.3);
}
.tl-card {
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.tl-card:hover {
  border-color: var(--pf-primary);
  transform: translateY(-1px);
}
.tl-year {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--pf-primary);
  background: var(--pf-bg);
  padding: 0 0.5rem;
  z-index: 2;
  letter-spacing: 0.05em;
}
.tl-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pf-text);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.tl-card-meta {
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
}
.tl-card-type {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  margin-bottom: 0.375rem;
}
.tl-card-type.type-paper {
  color: var(--pf-primary);
  background: rgba(59,130,246,0.1);
}
.tl-card-type.type-book {
  color: var(--pf-accent);
  background: rgba(6,214,160,0.1);
}

/* ================================================================
   Activity heatmap
   ================================================================ */
.heatmap-wrap {
  margin-bottom: 2rem;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 2px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  min-width: 0;
  transition: transform 0.1s;
}
.heatmap-cell:hover {
  transform: scale(1.5);
  z-index: 1;
}
.heatmap-cell.hl-1 { background: rgba(6,214,160,0.2); border-color: rgba(6,214,160,0.3); }
.heatmap-cell.hl-2 { background: rgba(6,214,160,0.4); border-color: rgba(6,214,160,0.5); }
.heatmap-cell.hl-3 { background: rgba(6,214,160,0.7); border-color: rgba(6,214,160,0.8); }
.heatmap-cell.hl-4 { background: rgba(6,214,160,1.0); border-color: rgba(6,214,160,1.0); }
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
}
.heatmap-legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.heatmap-months {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
  margin-bottom: 0.25rem;
  font-size: 0.5625rem;
  color: var(--pf-text-dim);
}

/* ================================================================
   Responsive layout
   ================================================================ */
@media (max-width: 768px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-card { padding: 1.5rem; }
  .profile-stats-row { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .profile-stat { padding: 0.75rem 0.5rem; }
  .profile-stat-value { font-size: 1.25rem; }
  .profile-actions { flex-direction: column; }
  .portfolio-stats { gap: 1rem; }
  .stat-num { font-size: 1.125rem; }
  .impact-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-nav { flex-wrap: wrap; }
  .timeline-line { left: 1rem; }
  .tl-dot { left: 1rem; }
  .tl-year { left: 1rem; transform: none; }
  .timeline-item.tl-left .tl-card,
  .timeline-item.tl-right .tl-card { margin-left: 2.5rem; margin-right: 0; text-align: left; }
  .heatmap-grid { gap: 1px; }
  .featured-grid { grid-template-columns: 1fr; }
  .coauthor-list { grid-template-columns: 1fr; }
  .contact-items { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .portfolio-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 480px) {
  .profile-name { font-size: 1.25rem; }
  .profile-stats-row { grid-template-columns: 1fr; }
  .impact-stats-grid { grid-template-columns: 1fr 1fr; }
  .impact-stat-value { font-size: 1.25rem; }
  .portfolio-name { font-size: 1.5rem; }
  .portfolio-actions .btn { font-size: 0.75rem; padding: 0.375rem 0.75rem; }
}

/* ================================================================
   Profile Activity Feed
   ================================================================ */
:root {
  --paf-dot-writing: #6366f1;
  --paf-dot-research: #22c55e;
  --paf-dot-review: #f59e0b;
  --paf-dot-publish: #a855f7;
  --paf-heatmap-0: var(--pf-bg-secondary);
  --paf-heatmap-1: rgba(34, 197, 94, 0.25);
  --paf-heatmap-2: rgba(34, 197, 94, 0.5);
  --paf-heatmap-3: rgba(34, 197, 94, 0.85);
}

[data-theme="light"] {
  --paf-dot-writing: #4f46e5;
  --paf-dot-research: #16a34a;
  --paf-dot-review: #d97706;
  --paf-dot-publish: #9333ea;
  --paf-heatmap-0: #ebedf0;
  --paf-heatmap-1: rgba(34, 197, 94, 0.3);
  --paf-heatmap-2: rgba(34, 197, 94, 0.55);
  --paf-heatmap-3: rgba(34, 197, 94, 0.9);
}

.profile-activity-feed {
  background: var(--pf-bg-card);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.paf-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--pf-text);
  margin: 0 0 1.25rem;
}

.paf-subheading {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pf-text-muted);
  margin: 0 0 0.75rem;
}

/* Stats row */
.paf-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.profile-stat-card {
  text-align: center;
  padding: 1rem 0.5rem;
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  transition: border-color 0.2s, transform 0.2s;
}

.profile-stat-card:hover {
  border-color: var(--pf-primary);
  transform: translateY(-2px);
}

.paf-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--pf-primary);
  font-variant-numeric: tabular-nums;
}

.paf-stat-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Tabs */
.paf-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--pf-bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--pf-border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.paf-tab {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--pf-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.paf-tab:hover {
  color: var(--pf-text);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .paf-tab:hover {
  background: rgba(0, 0, 0, 0.04);
}

.paf-tab-active {
  background: var(--pf-primary);
  color: #fff;
}

.paf-tab-active:hover {
  background: var(--pf-primary);
  color: #fff;
}

/* Activity list */
.paf-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.paf-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  transition: border-color 0.15s;
}

.paf-item:hover {
  border-color: var(--pf-primary);
}

.paf-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--pf-primary);
}

.paf-item-icon svg {
  stroke: var(--pf-primary);
}

.paf-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

.paf-item-action {
  font-weight: 600;
  color: var(--pf-text);
  white-space: nowrap;
}

.paf-item-detail {
  color: var(--pf-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paf-item-time {
  flex-shrink: 0;
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
  white-space: nowrap;
}

/* Type-colored dots */
.paf-dot-writing,
.paf-dot-research,
.paf-dot-review,
.paf-dot-publish {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.paf-dot-writing { background: var(--paf-dot-writing); }
.paf-dot-research { background: var(--paf-dot-research); }
.paf-dot-review { background: var(--paf-dot-review); }
.paf-dot-publish { background: var(--paf-dot-publish); }

.paf-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--pf-text-dim);
  font-size: 0.875rem;
  font-style: italic;
}

/* ================================================================
   Contribution Heatmap
   ================================================================ */
.contribution-heatmap {
  margin-bottom: 1.5rem;
}

.contribution-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 2px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  min-width: 0;
  transition: transform 0.1s;
  position: relative;
  cursor: default;
}

.heatmap-cell:hover {
  transform: scale(1.6);
  z-index: 1;
}

.heatmap-0 { background: var(--paf-heatmap-0); }
.heatmap-1 { background: var(--paf-heatmap-1); }
.heatmap-2 { background: var(--paf-heatmap-2); }
.heatmap-3 { background: var(--paf-heatmap-3); }

.heatmap-cell[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--pf-bg-card);
  color: var(--pf-text);
  border: 1px solid var(--pf-border);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.625rem;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  color: var(--pf-text-dim);
}

.heatmap-legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.heatmap-months {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
  margin-bottom: 0.25rem;
  font-size: 0.5625rem;
  color: var(--pf-text-dim);
}

/* ================================================================
   Activity Feed Responsive
   ================================================================ */
@media (max-width: 640px) {
  .paf-tabs {
    flex-direction: column;
  }

  .paf-tab {
    text-align: center;
  }

  .paf-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .contribution-heatmap-grid {
    grid-template-columns: repeat(26, 1fr);
  }

  .heatmap-months {
    grid-template-columns: repeat(26, 1fr);
  }

  .paf-item-body {
    flex-wrap: wrap;
  }
}

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

  .paf-stat-value {
    font-size: 1.25rem;
  }

  .profile-activity-feed {
    padding: 1rem;
  }
}

/* ================================================================
   Achievements & Badges
   ================================================================ */
.achievements-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--pf-bg-card);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
}

.achievements-heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--pf-text);
  margin: 0 0 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.achievements-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--pf-text-muted);
  background: var(--pf-bg-secondary);
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 0.75rem;
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  background: var(--pf-bg-secondary);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  outline: none;
}

.badge-card:hover,
.badge-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.badge-card-locked {
  filter: grayscale(0.85);
  opacity: 0.55;
}

.badge-card-locked:hover,
.badge-card-locked:focus-visible {
  opacity: 0.75;
  filter: grayscale(0.6);
}

.badge-card-unlocked {
  filter: none;
  opacity: 1;
  border-color: var(--pf-accent);
  box-shadow: 0 0 8px rgba(6, 214, 160, 0.15);
}

.badge-card-unlocked:hover,
.badge-card-unlocked:focus-visible {
  box-shadow: 0 0 16px rgba(6, 214, 160, 0.25), 0 6px 20px rgba(0, 0, 0, 0.2);
}

.badge-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.6rem;
}

.badge-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pf-text);
  margin-bottom: 0.2rem;
}

.badge-desc {
  font-size: 0.7rem;
  color: var(--pf-text-muted);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.badge-progress {
  width: 100%;
  height: 5px;
  background: var(--pf-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.badge-progress-fill {
  height: 100%;
  background: var(--pf-accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.badge-progress-text {
  font-size: 0.65rem;
  color: var(--pf-text-dim);
  margin-bottom: 0.3rem;
}

.badge-unlock-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--pf-accent);
}

/* Shimmer animation for newly unlocked badges */
.badge-new-unlock {
  position: relative;
  overflow: hidden;
}

.badge-new-unlock::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(6, 214, 160, 0.15),
    rgba(6, 214, 160, 0.3),
    rgba(6, 214, 160, 0.15),
    transparent
  );
  animation: badgeShimmer 1.5s ease-in-out 2;
  pointer-events: none;
  border-radius: 10px;
}

@keyframes badgeShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Light theme overrides for achievements */
[data-theme="light"] .achievements-section {
  background: var(--pf-bg-card);
  border-color: var(--pf-border);
}

[data-theme="light"] .badge-card {
  background: var(--pf-bg-secondary);
  border-color: var(--pf-border);
}

[data-theme="light"] .badge-card:hover,
[data-theme="light"] .badge-card:focus-visible {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .badge-card-unlocked {
  border-color: #059669;
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.12);
}

[data-theme="light"] .badge-card-unlocked:hover,
[data-theme="light"] .badge-card-unlocked:focus-visible {
  box-shadow: 0 0 16px rgba(5, 150, 105, 0.18), 0 6px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .badge-new-unlock::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(5, 150, 105, 0.1),
    rgba(5, 150, 105, 0.2),
    rgba(5, 150, 105, 0.1),
    transparent
  );
}

/* Responsive: 3 columns at 768px, 2 at 480px */
@media (max-width: 768px) {
  .achievements-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .achievements-section {
    padding: 1rem;
  }

  .badge-card {
    padding: 1rem 0.5rem;
  }

  .badge-icon {
    font-size: 2rem;
  }
}

/* ================================================================
   Settings & Preferences Panel
   ================================================================ */

.settings-section {
  background: var(--card-bg, #1e1e2e);
  border: 1px solid var(--border-color, #2e2e3e);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.settings-header {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  margin: 0 0 1rem 0;
}

.settings-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-color, #2e2e3e);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary, #a0a0b0);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.settings-tab:hover {
  color: var(--text-primary, #e0e0e0);
}

.settings-tab-active {
  color: var(--accent-color, #6c8cff);
  border-bottom-color: var(--accent-color, #6c8cff);
}

.settings-tab-content {
  min-height: 200px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  gap: 1rem;
}

.settings-label {
  font-size: 0.9rem;
  color: var(--text-primary, #e0e0e0);
  flex-shrink: 0;
}

/* Custom toggle switch (CSS-only) */
.settings-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.settings-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--toggle-bg, #3a3a4a);
  border-radius: 24px;
  transition: background-color 0.25s;
}

.settings-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--toggle-knob, #fff);
  border-radius: 50%;
  transition: transform 0.25s;
}

.settings-toggle input:checked + .settings-toggle-slider {
  background-color: var(--accent-color, #6c8cff);
}

.settings-toggle input:checked + .settings-toggle-slider::before {
  transform: translateX(20px);
}

.settings-toggle input:focus-visible + .settings-toggle-slider {
  outline: 2px solid var(--accent-color, #6c8cff);
  outline-offset: 2px;
}

.settings-select {
  padding: 0.375rem 0.625rem;
  background: var(--input-bg, #2a2a3a);
  color: var(--text-primary, #e0e0e0);
  border: 1px solid var(--border-color, #3a3a4a);
  border-radius: 6px;
  font-size: 0.85rem;
  min-width: 120px;
  cursor: pointer;
}

.settings-select:focus {
  outline: 2px solid var(--accent-color, #6c8cff);
  outline-offset: 1px;
}

.settings-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 6px;
  background: var(--toggle-bg, #3a3a4a);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-color, #6c8cff);
  border-radius: 50%;
  cursor: pointer;
}

.settings-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-color, #6c8cff);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.settings-slider-value {
  font-size: 0.8rem;
  color: var(--text-secondary, #a0a0b0);
  min-width: 36px;
  text-align: right;
}

.settings-export-btn,
.settings-reset-btn {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.settings-export-btn {
  background: var(--accent-color, #6c8cff);
  color: #fff;
}

.settings-export-btn:hover {
  opacity: 0.85;
}

.settings-reset-btn {
  background: var(--danger-color, #e05555);
  color: #fff;
}

.settings-reset-btn:hover {
  opacity: 0.85;
}

.settings-description {
  font-size: 0.78rem;
  color: var(--text-muted, #7a7a8a);
  margin: 0 0 0.375rem 0;
  line-height: 1.3;
}

/* Light theme overrides */
[data-theme="light"] .settings-section {
  background: var(--card-bg, #ffffff);
  border-color: var(--border-color, #ddd);
}

[data-theme="light"] .settings-header {
  color: var(--text-primary, #222);
}

[data-theme="light"] .settings-tab {
  color: var(--text-secondary, #666);
}

[data-theme="light"] .settings-tab:hover {
  color: var(--text-primary, #222);
}

[data-theme="light"] .settings-label {
  color: var(--text-primary, #222);
}

[data-theme="light"] .settings-select {
  background: var(--input-bg, #f5f5f5);
  color: var(--text-primary, #222);
  border-color: var(--border-color, #ccc);
}

[data-theme="light"] .settings-toggle-slider {
  background-color: var(--toggle-bg, #ccc);
}

[data-theme="light"] .settings-slider {
  background: var(--toggle-bg, #ccc);
}

[data-theme="light"] .settings-description {
  color: var(--text-muted, #888);
}

/* Responsive: vertical tabs at 640px */
@media (max-width: 640px) {
  .settings-tabs {
    flex-direction: column;
    border-bottom: none;
    border-right: 1px solid var(--border-color, #2e2e3e);
    margin-bottom: 0;
    margin-right: 1rem;
    gap: 0;
  }

  .settings-tab {
    border-bottom: none;
    border-right: 2px solid transparent;
    text-align: left;
    padding: 0.5rem 0.75rem;
  }

  .settings-tab-active {
    border-right-color: var(--accent-color, #6c8cff);
    border-bottom-color: transparent;
  }

  .settings-section {
    padding: 1rem;
  }

  .settings-row {
    flex-wrap: wrap;
  }

  .settings-slider {
    width: 100px;
  }
}

/* No-animations utility class */
body.no-animations,
body.no-animations * {
  transition: none !important;
  animation: none !important;
}

/* ================================================================
   ORCID Integration
   ================================================================ */

.orcid-section {
  background: var(--pf-bg-card);
  border: 1px solid var(--pf-border);
  border-left: 4px solid #a6ce39;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.orcid-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--pf-text);
  margin: 0 0 1rem;
}

.orcid-link-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.orcid-input {
  flex: 1;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: monospace;
  background: var(--pf-bg-secondary);
  color: var(--pf-text);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.orcid-input:focus {
  border-color: #a6ce39;
}

.orcid-link-btn {
  padding: 0.5rem 1.25rem;
  background: #a6ce39;
  color: #1a1a2e;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.orcid-link-btn:hover {
  background: #8fb830;
}

.orcid-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--pf-text-muted);
}

.orcid-profile-card {
  background: var(--pf-bg-secondary);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.orcid-profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.orcid-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #a6ce39;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

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

.orcid-profile-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--pf-text);
}

.orcid-profile-inst {
  font-size: 0.85rem;
  color: var(--pf-text-muted);
}

.orcid-profile-bio {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--pf-text-muted);
  line-height: 1.5;
}

.orcid-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  background: rgba(166, 206, 57, 0.12);
  color: #a6ce39;
  font-size: 0.8rem;
  font-family: monospace;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
  flex-shrink: 0;
}

.orcid-badge:hover {
  background: rgba(166, 206, 57, 0.22);
}

.orcid-badge-icon {
  flex-shrink: 0;
}

.orcid-stats-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.orcid-stat-card {
  flex: 1;
  background: var(--pf-bg-secondary);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}

.orcid-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #a6ce39;
}

.orcid-stat-label {
  font-size: 0.75rem;
  color: var(--pf-text-muted);
  margin-top: 0.25rem;
}

.orcid-pub-list {
  margin-top: 1rem;
}

.orcid-pub-list h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--pf-text);
  margin: 0 0 0.75rem;
}

.orcid-pub-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--pf-border);
}

.orcid-pub-item:last-child {
  border-bottom: none;
}

.orcid-pub-year {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pf-text-muted);
  min-width: 36px;
  padding-top: 0.15rem;
}

.orcid-pub-details {
  flex: 1;
  min-width: 0;
}

.orcid-pub-title {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--pf-text);
  line-height: 1.4;
}

.orcid-pub-journal {
  font-size: 0.8rem;
  color: var(--pf-text-muted);
  margin-top: 0.2rem;
}

.orcid-pub-type {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.orcid-pub-type--article {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.orcid-pub-type--conference {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.orcid-pub-type--book-chapter {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.orcid-pub-doi {
  font-size: 0.78rem;
  color: var(--pf-primary);
  text-decoration: none;
  display: inline-block;
  margin-top: 0.2rem;
}

.orcid-pub-doi:hover {
  text-decoration: underline;
}

.orcid-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.orcid-export-btn {
  padding: 0.45rem 1rem;
  background: var(--pf-bg-secondary);
  color: var(--pf-text);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.orcid-export-btn:hover {
  background: var(--pf-border);
}

.orcid-unlink-btn {
  padding: 0.45rem 1rem;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.orcid-unlink-btn:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* Light theme overrides for ORCID */
[data-theme="light"] .orcid-pub-type--article {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

[data-theme="light"] .orcid-pub-type--conference {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
}

[data-theme="light"] .orcid-pub-type--book-chapter {
  background: rgba(251, 146, 60, 0.1);
  color: #ea580c;
}

[data-theme="light"] .orcid-badge {
  background: rgba(166, 206, 57, 0.15);
}

[data-theme="light"] .orcid-unlink-btn {
  background: rgba(239, 68, 68, 0.08);
}

/* Responsive */
@media (max-width: 640px) {
  .orcid-link-form {
    flex-direction: column;
    align-items: stretch;
  }

  .orcid-input {
    max-width: none;
  }

  .orcid-profile-header {
    flex-wrap: wrap;
  }

  .orcid-stats-row {
    flex-direction: column;
  }

  .orcid-pub-item {
    flex-direction: column;
    gap: 0.25rem;
  }

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

/* ================================================================
   Achievement Badges (ab- prefix)
   ================================================================ */
.ab-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--pf-bg-card);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
}

.ab-summary {
  font-size: 0.9rem;
  color: var(--pf-text-muted);
  margin-bottom: 1.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--pf-bg-secondary);
  border-radius: 8px;
  display: inline-block;
}

.ab-summary-count {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary, #6366f1);
}

.ab-category-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--pf-text);
  margin: 1.25rem 0 0.75rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--pf-border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 1rem;
}

.ab-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 0.75rem;
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  background: var(--pf-bg-secondary);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
  outline: none;
  position: relative;
  overflow: hidden;
}

.ab-badge:hover,
.ab-badge:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  border-color: var(--color-primary, #6366f1);
}

.ab-badge-locked {
  filter: grayscale(0.85);
  opacity: 0.55;
}

.ab-badge-locked:hover,
.ab-badge-locked:focus-visible {
  opacity: 0.75;
  filter: grayscale(0.6);
}

.ab-badge:not(.ab-badge-locked) {
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.18);
}

.ab-badge:not(.ab-badge-locked):hover,
.ab-badge:not(.ab-badge-locked):focus-visible {
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.3), 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ab-badge-icon {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.ab-badge-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pf-text);
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.ab-badge-desc {
  font-size: 0.72rem;
  color: var(--pf-text-muted);
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.ab-badge-date {
  font-size: 0.68rem;
  color: var(--color-primary, #6366f1);
  font-weight: 500;
  margin-top: 0.25rem;
}

.ab-badge-progress {
  width: 100%;
  margin-top: 0.35rem;
}

.ab-badge-progress-text {
  font-size: 0.65rem;
  color: var(--pf-text-dim);
  margin-top: 0.2rem;
  display: block;
  text-align: center;
}

.ab-progress-bar {
  width: 100%;
  height: 5px;
  background: #374151;
  border-radius: 3px;
  overflow: hidden;
}

.ab-progress-fill {
  height: 100%;
  background: var(--color-primary, #6366f1);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Unlock pulse/glow animation */
.ab-unlock-animation {
  animation: ab-pulse 1.8s ease-in-out;
}

.ab-unlock-animation::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 2px solid var(--color-primary, #6366f1);
  animation: ab-pulse-ring 1.8s ease-out;
  pointer-events: none;
}

@keyframes ab-pulse {
  0%   { transform: scale(1); box-shadow: 0 0 0 rgba(99, 102, 241, 0); }
  15%  { transform: scale(1.07); box-shadow: 0 0 24px rgba(99, 102, 241, 0.5); }
  30%  { transform: scale(0.97); }
  45%  { transform: scale(1.04); box-shadow: 0 0 16px rgba(99, 102, 241, 0.35); }
  60%  { transform: scale(1); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(99, 102, 241, 0.18); }
}

@keyframes ab-pulse-ring {
  0%   { opacity: 1; transform: scale(0.95); }
  100% { opacity: 0; transform: scale(1.15); }
}

/* Light theme overrides */
[data-theme="light"] .ab-section {
  background: #fff;
  border-color: #e5e7eb;
}

[data-theme="light"] .ab-badge {
  background: #f9fafb;
  border-color: #e5e7eb;
}

[data-theme="light"] .ab-badge:not(.ab-badge-locked) {
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .ab-progress-bar {
  background: #e5e7eb;
}

[data-theme="light"] .ab-summary {
  background: #f3f4f6;
}

[data-theme="light"] .ab-category-title {
  border-color: #e5e7eb;
}

[data-theme="light"] .ab-badge:hover,
[data-theme="light"] .ab-badge:focus-visible {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 640px) {
  .ab-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
  }

  .ab-badge {
    padding: 1rem 0.5rem;
  }

  .ab-badge-icon {
    font-size: 1.75rem;
  }

  .ab-section {
    padding: 1rem;
  }
}

/* ================================================================
   CV Generator
   ================================================================ */

.cv-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cv-trigger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.cv-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cv-modal {
  width: 95vw;
  max-width: 1100px;
  height: 90vh;
  background: #1e2030;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cv-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e2e8f0;
}

.cv-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.cv-close-btn:hover {
  color: #f87171;
}

.cv-modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.cv-sidebar {
  width: 320px;
  min-width: 280px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  padding: 1rem;
  color: #cbd5e1;
}

.cv-sidebar h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 0.5rem;
}

.cv-template-card {
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.cv-template-card strong {
  display: block;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.cv-template-card small {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.cv-template-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.06);
}

.cv-template-card.cv-active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.12);
}

.cv-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 0.2rem 0;
  cursor: pointer;
}

.cv-section-toggles {
  margin: 1rem 0;
}

.cv-data-form {
  margin-top: 0.75rem;
}

.cv-data-form h5 {
  font-size: 0.85rem;
  color: #e2e8f0;
  margin: 0.75rem 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cv-form-section {
  margin-bottom: 0.5rem;
}

.cv-input {
  display: block;
  width: 100%;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.3rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.cv-input:focus {
  outline: none;
  border-color: #6366f1;
}

.cv-entry {
  position: relative;
  padding: 0.4rem 1.8rem 0.4rem 0;
  border-left: 2px solid rgba(99, 102, 241, 0.3);
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
}

.cv-remove-btn {
  position: absolute;
  top: 0.4rem;
  right: 0;
  background: none;
  border: none;
  color: #f87171;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.cv-add-btn {
  background: rgba(99, 102, 241, 0.15);
  border: none;
  color: #818cf8;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.cv-add-btn:hover {
  background: rgba(99, 102, 241, 0.3);
}

.cv-preview-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
}

.cv-preview {
  width: 100%;
  max-width: 700px;
  background: #fff;
  color: #1a1a1a;
  border-radius: 6px;
  padding: 2rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.88rem;
  line-height: 1.55;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
  min-height: 600px;
}

/* Academic template */
.cv-ac-name { font-size: 1.6rem; font-weight: 700; text-align: center; margin-bottom: 0.15rem; }
.cv-ac-title { text-align: center; font-style: italic; color: #444; margin-bottom: 0.15rem; }
.cv-ac-contact { text-align: center; font-size: 0.82rem; color: #666; margin-bottom: 1.5rem; }
.cv-ac-heading { font-weight: 700; font-size: 1rem; border-bottom: 2px solid #222; padding-bottom: 0.15rem; margin: 1.2rem 0 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; }
.cv-ac-item { margin-bottom: 0.45rem; }
.cv-ac-skill { display: inline-block; background: #eee; padding: 1px 7px; border-radius: 3px; font-size: 0.8rem; margin: 2px; }

/* Modern template */
.cv-preview-modern { display: flex; min-height: 500px; }
.cv-mod-sidebar { width: 38%; background: #f0f1f5; padding: 1.5rem; border-radius: 4px 0 0 4px; }
.cv-mod-main { flex: 1; padding: 1.5rem; }
.cv-mod-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.15rem; }
.cv-mod-role { font-style: italic; color: #555; margin-bottom: 0.75rem; }
.cv-mod-contact div { font-size: 0.8rem; color: #555; margin-bottom: 0.15rem; }
.cv-mod-sec { margin-top: 1rem; }
.cv-mod-sec strong { display: block; margin-bottom: 0.3rem; font-size: 0.9rem; }
.cv-mod-tag { display: inline-block; background: #dde1ea; padding: 2px 8px; border-radius: 3px; font-size: 0.78rem; margin: 2px; }
.cv-mod-ref { margin-bottom: 0.4rem; font-size: 0.82rem; }
.cv-mod-section h3 { font-size: 1rem; border-bottom: 1px solid #ccc; padding-bottom: 0.15rem; margin: 1rem 0 0.45rem; }
.cv-mod-item { margin-bottom: 0.4rem; }

/* Minimal template */
.cv-min-name { font-size: 1.5rem; margin: 0 0 0.25rem; font-weight: 700; }
.cv-min-meta { font-size: 0.82rem; color: #666; margin-bottom: 1.2rem; }
.cv-min-heading { font-size: 0.95rem; font-weight: 700; border-bottom: 1px solid #bbb; padding-bottom: 0.1rem; margin: 1rem 0 0.4rem; }
.cv-min-item { margin-bottom: 0.35rem; font-size: 0.85rem; }

/* Export bar */
.cv-export-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  justify-content: flex-end;
}

.cv-export-btn {
  padding: 0.45rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.cv-export-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.cv-export-html { border-color: #6366f1; color: #818cf8; }
.cv-export-html:hover { background: rgba(99, 102, 241, 0.15); }

/* Light theme */
[data-theme="light"] .cv-modal { background: #f8f9fb; }
[data-theme="light"] .cv-modal-header { border-color: #e2e8f0; }
[data-theme="light"] .cv-modal-title { color: #1e293b; }
[data-theme="light"] .cv-sidebar { border-color: #e2e8f0; color: #334155; }
[data-theme="light"] .cv-sidebar h4 { color: #64748b; }
[data-theme="light"] .cv-template-card { border-color: #e2e8f0; }
[data-theme="light"] .cv-template-card strong { color: #1e293b; }
[data-theme="light"] .cv-input { background: #fff; border-color: #d1d5db; color: #1e293b; }
[data-theme="light"] .cv-export-bar { border-color: #e2e8f0; }
[data-theme="light"] .cv-export-btn { background: #fff; border-color: #d1d5db; color: #334155; }
[data-theme="light"] .cv-data-form h5 { color: #1e293b; }
[data-theme="light"] .cv-section-toggle { color: #475569; }

/* Print */
@media print {
  .cv-overlay { position: static; background: none; backdrop-filter: none; }
  .cv-modal { width: 100%; max-width: none; height: auto; box-shadow: none; border-radius: 0; }
  .cv-modal-header, .cv-sidebar, .cv-export-bar { display: none; }
  .cv-modal-body { display: block; }
  .cv-preview-wrap { padding: 0; }
  .cv-preview { box-shadow: none; border-radius: 0; max-width: none; }
}

/* Responsive */
@media (max-width: 768px) {
  .cv-modal { width: 100vw; height: 100vh; border-radius: 0; }
  .cv-modal-body { flex-direction: column; }
  .cv-sidebar { width: 100%; min-width: 0; max-height: 40vh; border-right: none; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
  .cv-preview-wrap { padding: 1rem; }
  .cv-export-bar { flex-wrap: wrap; justify-content: center; }
}

/* ================================================================
   Achievement Badges – Gamification (abg)
   ================================================================ */

.abg-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

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

.abg-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}

.abg-counter {
  font-size: 0.85rem;
  color: #94a3b8;
  background: rgba(99, 102, 241, 0.12);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
}

.abg-stats {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.abg-stats-count {
  font-weight: 700;
  color: #818cf8;
}

.abg-stats-cat {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* Filters */
.abg-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.abg-filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.abg-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.abg-filter-btn.abg-active {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #a5b4fc;
  font-weight: 600;
}

/* Badge grid */
.abg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.abg-badge {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.5rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.15s;
}

.abg-badge:hover,
.abg-badge:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.07);
}

.abg-badge.abg-locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.abg-badge.abg-locked:hover,
.abg-badge.abg-locked:focus-visible {
  opacity: 0.6;
  filter: grayscale(0.3);
}

.abg-badge.abg-unlocked {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.08);
}

.abg-badge.abg-unlocked:hover,
.abg-badge.abg-unlocked:focus-visible {
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.18);
}

.abg-badge-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.abg-badge-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.abg-badge-desc {
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

/* Progress bar */
.abg-badge-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: auto;
}

.abg-badge-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Checkmark overlay */
.abg-badge-check {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.75rem;
  color: #22c55e;
  font-weight: 700;
}

/* Unlock date */
.abg-badge-date {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 0.2rem;
}

/* Unlock animation */
@keyframes abg-unlock {
  0%   { transform: scale(1); box-shadow: 0 0 0 rgba(99, 102, 241, 0); }
  30%  { transform: scale(1.12); box-shadow: 0 0 24px rgba(99, 102, 241, 0.4); }
  60%  { transform: scale(0.95); box-shadow: 0 0 8px rgba(99, 102, 241, 0.15); }
  100% { transform: scale(1); box-shadow: 0 0 12px rgba(99, 102, 241, 0.08); }
}

.abg-badge.abg-just-unlocked {
  animation: abg-unlock 0.8s ease forwards;
}

/* Recent unlocks */
.abg-recent {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.abg-recent h4 {
  font-size: 0.85rem;
  color: #cbd5e1;
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.abg-recent-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.8rem;
  color: #e2e8f0;
}

.abg-recent-item .abg-badge-date {
  margin-left: auto;
}

/* Share card */
.abg-share-card {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #e2e8f0;
  max-width: 300px;
  margin: 1rem auto;
}

.abg-share-btn {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid #6366f1;
  color: #a5b4fc;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.abg-share-btn:hover {
  background: rgba(99, 102, 241, 0.35);
}

/* Detail overlay / modal handled by Shared.showModal */
.abg-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
}

.abg-detail-modal {
  background: #1e1e2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 380px;
  width: 90%;
  color: #e2e8f0;
}

/* Light theme overrides */
[data-theme="light"] .abg-section {
  background: rgba(0, 0, 0, 0.02);
  border-color: #e2e8f0;
}

[data-theme="light"] .abg-title {
  color: #1e293b;
}

[data-theme="light"] .abg-counter {
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .abg-stats { color: #64748b; }
[data-theme="light"] .abg-stats-count { color: #4f46e5; }
[data-theme="light"] .abg-stats-cat { background: rgba(0, 0, 0, 0.04); }

[data-theme="light"] .abg-filter-btn {
  background: #fff;
  border-color: #d1d5db;
  color: #475569;
}

[data-theme="light"] .abg-filter-btn:hover { background: #f1f5f9; }

[data-theme="light"] .abg-filter-btn.abg-active {
  background: rgba(79, 70, 229, 0.1);
  border-color: #4f46e5;
  color: #4338ca;
}

[data-theme="light"] .abg-badge {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] .abg-badge:hover { background: #f8fafc; }
[data-theme="light"] .abg-badge.abg-unlocked { border-color: rgba(79, 70, 229, 0.3); }
[data-theme="light"] .abg-badge-name { color: #1e293b; }
[data-theme="light"] .abg-badge-desc { color: #64748b; }
[data-theme="light"] .abg-badge-progress { background: #e2e8f0; }

[data-theme="light"] .abg-recent { background: rgba(0, 0, 0, 0.02); }
[data-theme="light"] .abg-recent h4 { color: #334155; }
[data-theme="light"] .abg-recent-item { color: #1e293b; }

[data-theme="light"] .abg-share-card {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-color: rgba(79, 70, 229, 0.3);
  color: #1e293b;
}

[data-theme="light"] .abg-detail-modal {
  background: #fff;
  border-color: #e2e8f0;
  color: #1e293b;
}

/* Responsive */
@media (max-width: 640px) {
  .abg-section { padding: 1rem; }
  .abg-header { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .abg-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 0.5rem; }
  .abg-badge { padding: 0.75rem 0.4rem 0.5rem; }
  .abg-badge-icon { font-size: 1.5rem; }
  .abg-filters { gap: 0.3rem; }
  .abg-filter-btn { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
}

/* ================================================================
   Research Interests Editor
   ================================================================ */
.rie-section {
  background: var(--pf-bg-secondary);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.rie-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.rie-collapse-btn {
  background: none;
  border: none;
  color: var(--pf-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.rie-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--pf-text);
  margin: 0;
  flex: 1;
}

.rie-counter {
  font-size: 0.75rem;
  color: var(--pf-text-dim);
  background: rgba(255,255,255,0.06);
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
}

.rie-export-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.rie-export-btn:hover { opacity: 1; }

/* Input with autocomplete */
.rie-input-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.rie-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  color: var(--pf-text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.rie-input:focus { border-color: var(--pf-primary); }
.rie-input::placeholder { color: var(--pf-text-dim); }

.rie-autocomplete {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--pf-bg-card);
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.rie-ac-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--pf-text);
  transition: background 0.15s;
}
.rie-ac-item:hover { background: rgba(255,255,255,0.06); }

.rie-ac-cat {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--pf-text-dim);
}

/* Tags area */
.rie-tags-area { min-height: 48px; }

.rie-group { margin-bottom: 0.75rem; }
.rie-group:last-child { margin-bottom: 0; }

.rie-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pf-text-dim);
  padding-left: 0.5rem;
  border-left: 3px solid;
  margin-bottom: 0.4rem;
}

.rie-group-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Individual tag */
.rie-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--pf-border);
  border-radius: 20px;
  padding: 0.3rem 0.5rem 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: var(--pf-text);
  cursor: grab;
  transition: background 0.15s, box-shadow 0.15s;
  user-select: none;
}
.rie-tag:hover { background: rgba(255,255,255,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.rie-tag.rie-dragging { opacity: 0.4; }

.rie-tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rie-tag-name { white-space: nowrap; }

.rie-tag-vis {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 0.15rem;
  line-height: 1;
}
.rie-eye-off { opacity: 0.35; }

.rie-tag-remove {
  background: none;
  border: none;
  color: var(--pf-text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  transition: color 0.15s;
}
.rie-tag-remove:hover { color: #ef4444; }

/* Empty state */
.rie-empty {
  text-align: center;
  padding: 1.5rem 0;
}

.rie-empty-text {
  font-size: 0.82rem;
  color: var(--pf-text-dim);
  margin-bottom: 0.75rem;
}

.rie-empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.rie-suggest-btn {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: var(--pf-primary);
  border-radius: 16px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}
.rie-suggest-btn:hover { background: rgba(59,130,246,0.2); }

/* Browse / Category browser */
.rie-browse-wrap { margin-top: 0.75rem; text-align: center; }

.rie-browse-btn {
  background: none;
  border: 1px solid var(--pf-border);
  color: var(--pf-text-muted);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.rie-browse-btn:hover { border-color: var(--pf-primary); color: var(--pf-primary); }

.rie-cat-panel { margin-top: 0.75rem; }

.rie-cat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.rie-cat-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--pf-border);
  color: var(--pf-text-muted);
  border-radius: 14px;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.rie-cat-filter-btn:hover { border-color: var(--pf-primary); color: var(--pf-text); }
.rie-cat-filter-btn.rie-active { border-color: var(--pf-primary); color: var(--pf-primary); background: rgba(59,130,246,0.1); }

.rie-cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rie-cat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--pf-border);
  color: var(--pf-text);
  border-radius: 16px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.rie-cat-item:hover:not(:disabled) { background: rgba(255,255,255,0.08); border-color: var(--pf-primary); }
.rie-cat-item.rie-added { opacity: 0.4; cursor: default; }

.rie-check { color: var(--pf-accent); font-size: 0.7rem; }

/* Light theme overrides */
[data-theme="light"] .rie-section { background: #fff; border-color: #e2e8f0; }
[data-theme="light"] .rie-input { background: #f8fafc; border-color: #e2e8f0; color: #1e293b; }
[data-theme="light"] .rie-input::placeholder { color: #94a3b8; }
[data-theme="light"] .rie-autocomplete { background: #fff; border-color: #e2e8f0; box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
[data-theme="light"] .rie-ac-item { color: #1e293b; }
[data-theme="light"] .rie-ac-item:hover { background: #f1f5f9; }
[data-theme="light"] .rie-tag { background: #f1f5f9; border-color: #e2e8f0; color: #1e293b; }
[data-theme="light"] .rie-tag:hover { background: #e2e8f0; }
[data-theme="light"] .rie-counter { background: #f1f5f9; color: #64748b; }
[data-theme="light"] .rie-cat-filter-btn { background: #f8fafc; border-color: #e2e8f0; color: #64748b; }
[data-theme="light"] .rie-cat-item { background: #f8fafc; border-color: #e2e8f0; color: #1e293b; }
[data-theme="light"] .rie-suggest-btn { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.2); }

/* Responsive */
@media (max-width: 640px) {
  .rie-section { padding: 1rem; }
  .rie-header { flex-wrap: wrap; }
  .rie-cat-filters { gap: 0.25rem; }
  .rie-cat-filter-btn { font-size: 0.68rem; padding: 0.2rem 0.45rem; }
  .rie-tag { font-size: 0.75rem; }
}
