/* ═══════════════════════════════════════════════════
   UNC Research Tracker — Design System
   ═══════════════════════════════════════════════════ */

/* ─── 1. Tokens ────────────────────────────────── */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Surface */
  --bg:          #f8fafc;
  --bg-2:        #f1f5f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --border-2:    #f1f5f9;

  /* Text */
  --text:        #0f172a;
  --text-2:      #64748b;
  --text-3:      #94a3b8;

  /* Brand */
  --blue:        #4b9cd3;
  --blue-dark:   #2e7ebb;
  --blue-bg:     #eff6ff;
  --navy:        #13294b;

  /* Status */
  --green:       #16a34a;  --green-bg:  #dcfce7;
  --amber:       #d97706;  --amber-bg:  #fef3c7;
  --red:         #dc2626;  --red-bg:    #fee2e2;
  --info:        #0284c7;  --info-bg:   #e0f2fe;
  --purple:      #7c3aed;  --purple-bg: #ede9fe;
  --gray:        #6b7280;  --gray-bg:   #f3f4f6;

  /* Layout */
  --sidebar-w:   240px;
  --topbar-h:    56px;

  /* Radius */
  --r-sm:  4px;
  --r-md:  6px;
  --r-lg:  8px;
  --r-xl:  12px;
  --r-2xl: 16px;
  --r-pill: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-xl: 0 10px 24px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
}

/* ─── 2. Navigation progress bar ───────────────── */
#nav-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  opacity: 0;
  background: var(--blue);
  z-index: 99999;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
}

/* ─── 3. Reset & Base ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); }
a:hover { color: var(--blue-dark); }

/* ─── 3. App Layout ────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── 4. Sidebar ───────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.sidebar-brand img {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

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

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  padding: 14px 10px 4px;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.sidebar-link,
button.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .13s, color .13s;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
}

.sidebar-link:hover {
  background: var(--border-2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--blue-bg);
  color: var(--blue-dark);
  font-weight: 600;
}

.sidebar-link i,
button.sidebar-link i:first-child {
  font-size: 15px;
  flex-shrink: 0;
  opacity: .7;
}

.sidebar-link.active i { opacity: 1; }

.sidebar-link--disabled {
  opacity: .45;
  pointer-events: none;
  cursor: not-allowed;
}

.sidebar-submenu {
  padding-left: 28px;
  padding-right: 4px;
}

.sidebar-sublink {
  display: block;
  padding: 6px 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .13s, color .13s;
}

.sidebar-sublink:hover {
  background: var(--border-2);
  color: var(--text);
  text-decoration: none;
}

.sidebar-sublink.active {
  color: var(--blue-dark);
  font-weight: 600;
}

.chevron {
  margin-left: auto;
  transition: transform .18s ease;
  font-size: 11px !important;
  opacity: .6;
}

.chevron.open { transform: rotate(90deg); }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-3);
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .13s, background .13s;
  flex-shrink: 0;
}

.sidebar-logout:hover {
  color: var(--red);
  background: var(--red-bg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ─── 5. Main Wrapper ──────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ─── 6. Topbar ────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-spacer { flex: 1; }

.topbar-menu-btn {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background .13s;
  flex-shrink: 0;
}

.topbar-menu-btn:hover { background: var(--border-2); color: var(--text); }

.topbar-icon-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background .13s;
  flex-shrink: 0;
}

.topbar-icon-btn:hover { background: var(--border-2); color: var(--text); }

.topbar-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.topbar-profile-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px;
  border-radius: var(--r-md);
  transition: background .13s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.topbar-profile-btn:hover { background: var(--border-2); }

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ─── 7. Main Content Area ─────────────────────── */
.main-content {
  flex: 1;
  padding: 28px 28px 40px;
}

.messages-container { margin-bottom: 20px; }

/* ─── 8. Page Header ───────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-breadcrumb {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin: 5px 0 0;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
  padding-top: 4px;
}

/* Force consistent sizing for all buttons in the page header actions bar */
.page-actions .btn {
  font-size: 12.5px;
  padding: 5px 11px;
  line-height: 1.4;
}

/* ─── 9. Cards ─────────────────────────────────── */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-xl) !important;
  box-shadow: none !important;
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 14px 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-wrap: wrap;
}

.card-header h5,
.card-header h6 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text) !important;
  margin: 0;
}

/* Backward compat: old dark card headers */
.card-header .text-white       { color: var(--text)   !important; }
.card-header .text-white-50    { color: var(--text-2) !important; }
.card-header .header-subtitle  { color: var(--text-2) !important; font-size: 12.5px; }

.card-body { padding: 20px; }

/* ─── 10. Stat Cards ───────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  border-left: 3px solid var(--blue);
  transition: box-shadow .15s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card--warning { border-left-color: var(--amber); }
.stat-card--danger  { border-left-color: var(--red); }
.stat-card--success { border-left-color: var(--green); }
.stat-card--purple  { border-left-color: var(--purple); }

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 5px;
}

.stat-hint {
  font-size: 12px;
  color: var(--text-3);
}

/* Backward compat aliases */
.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  border-left: 3px solid var(--blue);
}

.insight-icon { display: none; }

.insight-body { margin-top: 0 !important; }

.insight-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px !important;
}

.insight-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.insight-hint {
  font-size: 12px;
  color: var(--text-3);
}

/* ─── 11. Status Badges ────────────────────────── */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--gray-bg);
  color: var(--gray);
}

.status-chip--ghost { background: var(--gray-bg); color: var(--gray); }
.status-chip--hero  { background: rgba(255,255,255,.15); color: #fff; }

/* Project statuses */
.status-planning           { background: var(--blue-bg);   color: var(--info); }
.status-active             { background: var(--green-bg);  color: var(--green); }
.status-on-hold,
.status-on_hold            { background: var(--amber-bg);  color: var(--amber); }
.status-completed          { background: #f0fdf4;          color: #166534; }
.status-cancelled          { background: var(--red-bg);    color: #991b1b; }
.status-published          { background: var(--purple-bg); color: var(--purple); }
.status-data-collection,
.status-data_collection    { background: var(--info-bg);   color: var(--info); }
.status-analysis           { background: #fef9c3;          color: #92400e; }
.status-writing            { background: #fce7f3;          color: #9d174d; }
.status-review             { background: var(--gray-bg);   color: var(--gray); }
.status-draft              { background: var(--gray-bg);   color: var(--gray); }

/* IRB badges */
.irb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.irb-not-started    { background: var(--gray-bg);   color: var(--gray); }
.irb-exempt         { background: var(--green-bg);  color: var(--green); }
.irb-approved       { background: var(--green-bg);  color: var(--green); }
.irb-in-review      { background: var(--amber-bg);  color: var(--amber); }
.irb-renewal-needed { background: var(--red-bg);    color: var(--red); }
.irb-closed         { background: var(--gray-bg);   color: var(--gray); }
.irb-not-applicable { background: var(--gray-bg);   color: var(--text-3); }
.irb-n-a            { background: var(--gray-bg);   color: var(--text-3); }
.irb-submitted      { background: var(--blue-bg);   color: var(--blue-dark); }
.irb-draft          { background: var(--gray-bg);   color: var(--gray); }
.irb-revision       { background: var(--amber-bg);  color: var(--amber); }
.irb-accepted       { background: var(--green-bg);  color: var(--green); }
.irb-rejected       { background: var(--red-bg);    color: var(--red); }

/* ─── 12. Tables ───────────────────────────────── */
.table {
  font-size: 13.5px;
  --bs-table-bg: transparent;
}

.table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border) !important;
  padding: 10px 16px;
  background: transparent;
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-2) !important;
}

.table tbody tr:last-child { border-bottom: none !important; }

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--text);
  border: none;
}

.table tbody tr:hover { background: #fafbfc; }

.project-title a {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.project-title a:hover { color: var(--blue-dark); }

/* Sortable column headers */
.th-sort {
  cursor: pointer;
  user-select: none;
}
.th-sort:hover { color: var(--text-2) !important; }
.th-sort .sort-icon {
  opacity: 0.25;
  font-size: 10px;
  margin-left: 3px;
  vertical-align: middle;
}
.th-sort.sort-active .sort-icon {
  opacity: 1;
  color: var(--blue);
}

/* Clickable rows */
.project-row { transition: background .1s; }
.project-row:hover { background: #f5f8fc !important; cursor: pointer; }

/* Poll update animations */
@keyframes row-flash {
  0%, 60% { background-color: #fef9c3; }
  100%     { background-color: transparent; }
}
@keyframes row-added {
  0%, 60% { background-color: #dcfce7; }
  100%     { background-color: transparent; }
}
.row-flash { animation: row-flash 2.5s ease-out forwards; }
.row-added { animation: row-added 2.5s ease-out forwards; }
.row-removing { opacity: 0; transition: opacity .4s ease-out; }

/* ─── 13. Buttons ──────────────────────────────── */
.btn {
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  line-height: 1.4;
}

.btn-sm {
  font-size: 12.5px;
  padding: 5px 11px;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: #fff;
}

.btn-outline-primary {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-outline-primary:hover {
  background: var(--blue);
  color: #fff;
}

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-2);
  background: transparent;
}

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

.btn-outline-danger { border-color: #fca5a5; color: var(--red); }
.btn-outline-danger:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }

.btn-light {
  background: var(--border-2);
  border-color: var(--border);
  color: var(--text);
}

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

.btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-sm.btn-icon-only {
  width: 28px;
  height: 28px;
}

/* ─── 14. Forms ────────────────────────────────── */
.form-control,
.form-select {
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(75,156,211,.15);
  outline: none;
}

.form-control.border-0,
.form-select.border-0 {
  border: 1px solid var(--border) !important;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}

.input-group-text {
  font-size: 13.5px;
  border: 1px solid var(--border);
  color: var(--text-3);
  background: var(--border-2);
  border-radius: var(--r-md);
}

.input-group > .form-control:not(:first-child),
.input-group > .form-select:not(:first-child) {
  border-left: none;
}

/* Fix input-group border-radius so left/right elements are shaped correctly */
.input-group > .input-group-text:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group > .form-control:last-child,
.input-group > .form-select:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Focus ring spans the whole group */
.input-group:focus-within {
  border-radius: var(--r-md);
  box-shadow: 0 0 0 3px rgba(75,156,211,.15);
}
.input-group:focus-within .input-group-text {
  border-color: var(--blue);
}
.input-group:focus-within .form-control,
.input-group:focus-within .form-select {
  border-color: var(--blue);
}
.input-group:focus-within .form-control:focus,
.input-group:focus-within .form-select:focus {
  box-shadow: none;
}

/* ─── 15. Timeline ─────────────────────────────── */
.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-2);
}

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

.timeline-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--blue-bg);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}

.timeline-label {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}

.timeline-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

/* ─── 16. Pagination ───────────────────────────── */
.page-link {
  border-radius: var(--r-md) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-2);
  font-size: 13px;
  padding: 5px 10px;
  background: var(--surface);
}

.page-link:hover {
  background: var(--border-2);
  color: var(--text);
  border-color: var(--border);
}

.page-item.active .page-link {
  background: var(--blue);
  border-color: var(--blue) !important;
  color: #fff;
}

.page-item.disabled .page-link {
  color: var(--text-3);
  background: var(--border-2);
}

/* ─── 17. Dropdowns ────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  font-size: 13.5px;
  padding: 4px;
}

.dropdown-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  padding: 8px 10px 4px;
}

.dropdown-item {
  border-radius: var(--r-md);
  padding: 7px 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  white-space: normal;
}

.dropdown-item:hover, .dropdown-item:focus {
  background: var(--border-2);
  color: var(--text);
}

.dropdown-item.text-danger:hover {
  background: var(--red-bg);
  color: var(--red);
}

.dropdown-divider {
  border-color: var(--border);
  margin: 4px 0;
}

/* ─── 18. Alerts ───────────────────────────────── */
.alert {
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  font-size: 13.5px;
}

.alert-success { background: var(--green-bg); color: #166534; border-color: #bbf7d0; }
.alert-warning { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }
.alert-danger  { background: var(--red-bg);   color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--info-bg);  color: #075985; border-color: #bae6fd; }

/* ─── 19. Badges ───────────────────────────────── */
.badge-coming-soon {
  background: var(--blue-bg);
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-pill);
}

/* ─── 20. Misc ─────────────────────────────────── */
.quick-action-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--blue-bg);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.list-group-item {
  border-color: var(--border-2);
  padding: 12px 0;
}

/* ─── 21. Page Hero (Backward Compat) ──────────── */
/* Pages not yet updated to the new page-header pattern */
.page-hero.card {
  border-radius: var(--r-xl) !important;
}

.page-hero .page-hero-title,
.page-hero h1 {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin-bottom: 8px !important;
}

.page-hero .hero-breadcrumb,
.page-hero .hero-breadcrumb span {
  color: var(--text-3) !important;
}

.page-hero .hero-subtitle {
  color: var(--text-2) !important;
  font-size: 13.5px !important;
}

.page-hero .text-white,
.page-hero .fw-semibold.text-white {
  color: var(--text) !important;
}

.page-hero .text-white-50 {
  color: var(--text-2) !important;
}

.page-hero .btn-outline-light {
  color: var(--text-2);
  border-color: var(--border);
  background: transparent;
}

.page-hero .btn-outline-light:hover {
  background: var(--border-2);
  color: var(--text);
  border-color: var(--border);
}

.page-hero .btn-light {
  background: var(--border-2);
  border-color: var(--border);
  color: var(--text);
}

.page-hero .hero-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  margin-top: 12px;
}

.page-hero .hero-summary span {
  color: var(--text-2) !important;
}

.page-hero .hero-summary strong {
  color: var(--text) !important;
  font-weight: 700;
}

.page-hero .status-chip--hero {
  background: var(--border-2);
  color: var(--text-2);
}

/* ─── 22. Project Detail Beta ──────────────────── */
.project-beta-hero {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--r-xl) !important;
}

.project-beta-hero::after { display: none !important; }

.project-beta-hero__title {
  color: var(--text) !important;
  font-size: 24px !important;
}

.project-beta-hero .text-white-50 {
  color: var(--text-3) !important;
}

.project-beta-hero .fw-semibold {
  color: var(--text) !important;
}

.project-beta-chip {
  background: var(--border-2) !important;
  color: var(--text-2) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  border-radius: var(--r-pill) !important;
  padding: 4px 12px !important;
}

.project-beta-hero .btn-outline-light {
  color: var(--text-2);
  border-color: var(--border);
  background: transparent;
}

.project-beta-hero .btn-outline-light:hover {
  background: var(--border-2);
  color: var(--text);
  border-color: var(--border);
}

.project-beta-hero .btn-light {
  background: var(--border-2);
  border-color: var(--border);
  color: var(--text);
}

.project-beta-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: none;
}

.project-beta-panel__title {
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  color: var(--text-3) !important;
  font-weight: 700 !important;
}

.project-beta-discussion {
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}

/* ─── 23. Login Page ───────────────────────────── */
body.login-page {
  background: var(--navy);
}

.login-main {
  min-height: 100vh;
  display: flex;
  padding: 0;
  margin: 0;
}

.login-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Left branding panel */
.login-panel-left {
  flex: 0 0 420px;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 52px;
  color: #fff;
}

.login-logo img {
  height: 32px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}

.login-headline {
  margin-top: auto;
  padding-top: 64px;
}

.login-headline h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  margin-bottom: 12px;
}

.login-headline p {
  font-size: 14px;
  color: rgba(255,255,255,.55);
  line-height: 1.65;
  margin: 0;
}

.login-features {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255,255,255,.7);
}

.login-feature i {
  width: 32px;
  height: 32px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  color: var(--blue);
}

.login-panel-left-footer {
  font-size: 12px;
  color: rgba(255,255,255,.3);
  padding-top: 48px;
}

/* Right form panel */
.login-panel-right {
  flex: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

.login-form-wrap {
  width: 100%;
  max-width: 400px;
}

.login-form-wrap h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-form-wrap .login-form-sub {
  font-size: 13.5px;
  color: var(--text-3);
  margin-bottom: 32px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.login-field input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.login-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(75,156,211,.15);
}

.login-field input::placeholder {
  color: var(--text-3);
}

.login-submit {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}

.login-submit:hover {
  background: var(--blue-dark);
  box-shadow: 0 2px 8px rgba(75,156,211,.35);
}

.login-submit:active {
  background: var(--blue-dark);
  box-shadow: none;
}

.login-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--r-lg);
  font-size: 13px;
  color: #991b1b;
  margin-bottom: 20px;
}

.login-error i { flex-shrink: 0; margin-top: 1px; font-size: 15px; }

.login-help-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .login-panel-left { display: none; }
  .login-panel-right { background: var(--navy); }
  .login-form-wrap h2 { color: #fff; }
  .login-form-wrap .login-form-sub { color: rgba(255,255,255,.5); }
  .login-field label { color: rgba(255,255,255,.7); }
  .login-field input { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: #fff; }
  .login-field input::placeholder { color: rgba(255,255,255,.3); }
  .login-field input:focus { border-color: var(--blue); background: rgba(255,255,255,.12); }
  .login-help-note { color: rgba(255,255,255,.35); }
}

/* ─── 24. Footer ───────────────────────────────── */
.footer-modern {
  background: var(--navy);
  padding: 20px 0;
  flex-shrink: 0;
}

.footer-logo {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.1);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.footer-title { color: #fff; font-size: 14px; font-weight: 600; margin: 0; }
.footer-subtitle { color: rgba(255,255,255,.5); font-size: 12px; }

.footer-links { margin-bottom: 4px; }

.footer-link {
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 13px;
  margin-right: 16px;
  transition: color .13s;
}

.footer-link:hover { color: #fff; }

/* ─── 25. User Edit Page ───────────────────────── */
.user-edit-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--r-pill);
  background: var(--blue);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -.5px;
}

.user-edit-meta {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-edit-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.user-edit-meta-label {
  color: var(--text-3);
  flex-shrink: 0;
}

.user-edit-meta-value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

/* ─── 26. Misc backwards compat ────────────────── */
.navbar-brand-image { max-height: 32px; width: auto; }

.page-shell { /* wrapper class, no special styles needed */ }

.nav-link--disabled { opacity: .45; pointer-events: none; cursor: not-allowed; }

.project-card {
  border: 1px solid var(--border) !important;
  border-radius: var(--r-xl) !important;
  background: var(--surface);
}

/* Remove Bootstrap's default shadows on cards */
.card.shadow-sm, .card.shadow, .card.shadow-lg { box-shadow: none !important; }

/* ─── 26. Responsive ───────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }

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

  .main-wrapper { margin-left: 0; }

  .main-content { padding: 20px 16px 32px; }
}

@media (max-width: 767.98px) {
  .page-header { gap: 12px; }
  .page-title  { font-size: 18px; }
  .stats-grid  { gap: 12px; }
  .stat-value  { font-size: 26px; }
  .insight-value { font-size: 26px; }
}

.user-loading-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 13px;
}

.user-loading-indicator.is-active {
  display: inline-flex;
}

/* ── User directory table ──────────────────────────────── */
.user-cell {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.user-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--r-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-bg);
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.user-table td .text-muted.small { font-size: 12px; }

.badge-admin,
.badge-status-active,
.badge-status-inactive {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  line-height: 1.45;
}
.badge-admin           { background: var(--purple-bg); color: var(--purple); }
.badge-status-active   { background: var(--green-bg);  color: var(--green); }
.badge-status-inactive { background: var(--gray-bg);   color: var(--text-2); }

/* ── Additional status chips (conference abstracts + multi-word project statuses) ── */
.status-pending                                  { background: var(--amber-bg);  color: var(--amber); }
.status-submitted                                { background: var(--blue-bg);   color: var(--blue-dark); }
.status-under-review, .status-under_review       { background: var(--amber-bg);  color: var(--amber); }
.status-accepted                                 { background: var(--green-bg);  color: var(--green); }
.status-rejected                                 { background: var(--red-bg);    color: var(--red); }
.status-withdrawn                                { background: var(--gray-bg);   color: var(--text-2); }
.status-irb-pending, .status-irb_pending         { background: var(--amber-bg);  color: var(--amber); }
.status-irb-approved, .status-irb_approved       { background: var(--green-bg);  color: var(--green); }
.status-data-analysis, .status-data_analysis     { background: var(--info-bg);   color: var(--info); }
.status-manuscript-prep, .status-manuscript_prep { background: var(--blue-bg);   color: var(--blue-dark); }
.status-manuscript-review, .status-manuscript_review,
.status-manuscript-under-review                  { background: var(--amber-bg);  color: var(--amber); }
.status-resubmitted                              { background: var(--blue-bg);   color: var(--blue-dark); }
.status-revisions, .status-revision              { background: var(--amber-bg);  color: var(--amber); }

/* ── Utilities ─────────────────────────────────────────── */
.min-w-0, .min-width-0 { min-width: 0; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }

/* ── Sortable headers (alias of .th-sort for the user directory table) ── */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--text-2) !important; }
.sortable .sort-icon { opacity: .35; font-size: 10px; margin-left: 3px; vertical-align: middle; }
.sortable[aria-sort]:not([aria-sort="none"]) .sort-icon { opacity: 1; color: var(--blue); }

/* ── Chip color variants (categorical labels: conf type, virtual/hybrid, etc.) ── */
.status-chip.chip-blue   { background: var(--blue-bg);   color: var(--blue-dark); }
.status-chip.chip-info   { background: var(--info-bg);   color: var(--info); }
.status-chip.chip-green  { background: var(--green-bg);  color: var(--green); }
.status-chip.chip-amber  { background: var(--amber-bg);  color: var(--amber); }
.status-chip.chip-red    { background: var(--red-bg);    color: var(--red); }
.status-chip.chip-purple { background: var(--purple-bg); color: var(--purple); }
.status-chip.chip-gray   { background: var(--gray-bg);   color: var(--text-2); }
