/* ═══════════════════════════════════════════════════════════════
   NMBL — Nigerian Marine Biodiversity Reference Library
   styles.css  ·  Single canonical stylesheet (no duplicates)
═══════════════════════════════════════════════════════════════ */

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

/* ── Design tokens ── */
:root {
  --bg: #ffffff; --bg2: #f6f8fc; --bg3: #eaeff6;
  --text: #0e1724; --text2: #3d4f63; --text3: #7a8fa6;
  --border: rgba(14,23,36,0.09); --border2: rgba(14,23,36,0.18);
  --green-bg: #e0f5ed; --green: #0a6b4e;
  --red-bg: #fceaea;   --red: #9b2525;
  --amber-bg: #fef3e0; --amber: #7d4a06;
  --blue-bg: #e8f1ff;  --blue: #1462e8;
  --purple-bg: #f2d9fb; --purple: #7a27a0;
  --teal-bg: #e0f8fb;  --teal: #0a7d96;
  --radius: 9px; --radius-lg: 14px;
  --navy: #091e38;
  --shadow-sm: 0 1px 4px rgba(14,23,36,0.06), 0 0 0 0.5px rgba(14,23,36,0.07);
  --shadow-md: 0 4px 16px rgba(14,23,36,0.09), 0 0 0 0.5px rgba(14,23,36,0.07);
  --shadow-lg: 0 12px 36px rgba(14,23,36,0.12), 0 0 0 1px rgba(14,23,36,0.06);
}

/* ── Base ── */
html { scroll-behavior: smooth; }
body {
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg2); color: var(--text); font-size: 14px; min-height: 100vh;
  line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.015em; }
p { line-height: 1.75; }
code, pre { font-family: 'DM Mono', 'JetBrains Mono', monospace; }
::selection { background: rgba(20,98,232,0.15); }

/* ── Scrollbar ── */
* { scrollbar-width: thin; scrollbar-color: var(--bg3) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1.5rem 2rem; }
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

/* ── Skip link ── */
.skip-to-content, .skip-link {
  position: absolute; top: -40px; left: 1rem; z-index: 99999;
  background: var(--blue); color: #fff; padding: 8px 16px;
  border-radius: 0 0 8px 8px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: top 0.2s;
}
.skip-to-content:focus, .skip-link:focus { top: 0; }

/* ── Focus ── */
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

/* ── Animations ── */
@keyframes fadeIn        { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn       { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes panelIn       { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes gradientSlide { 0% { background-position: 0%; } 100% { background-position: 300%; } }
@keyframes shimmer       { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

/* ── Tabs ── */
.tabs {
  background: var(--bg); border-bottom: 1.5px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 4px; margin-bottom: 0; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 18px; font-size: 12.5px; cursor: pointer; border: none;
  background: none; color: var(--text2); border-bottom: 2.5px solid transparent;
  margin-bottom: -1px; transition: all 0.15s; white-space: nowrap;
  font-family: inherit; letter-spacing: 0.01em;
}
.tab:hover:not(.active) { color: var(--text); background: var(--bg3); border-radius: 6px 6px 0 0; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.panel { display: none; }
.panel.active { display: block; animation: panelIn 0.18s ease; }

/* ── Stat grid ── */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 1.5rem; }
.stat {
  background: var(--bg); border-radius: var(--radius); padding: 16px;
  border: 0.5px solid var(--border); cursor: pointer;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: all 0.2s cubic-bezier(0.2,0,0,1);
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg, var(--blue), var(--teal));
  opacity: 0; transition: opacity 0.2s;
}
.stat:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat:hover::before { opacity: 1; }
.stat-label { font-size: 11px; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-val { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-val.green  { color: var(--green); }
.stat-val.red    { color: var(--red); }
.stat-val.amber  { color: var(--amber); }
.stat-val.purple { color: var(--purple); }
.stat.clickable-hint::after { content: "→ view"; font-size: 10px; color: var(--text3); display: block; margin-top: 4px; }

/* ── Cards ── */
.card { background: var(--bg); border-radius: var(--radius-lg); border: 0.5px solid var(--border); padding: 1.25rem 1.5rem; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.info-card {
  background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; transition: box-shadow 0.2s, transform 0.2s;
}
.info-card:hover { box-shadow: 0 4px 20px rgba(14,23,36,0.1); transform: translateY(-1px); }
.info-card h3 { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.info-card p, .info-card li { font-size: 13px; color: var(--text2); line-height: 1.75; }
.info-card ul { padding-left: 16px; margin-top: 4px; }
.info-card li { margin-bottom: 3px; }
.accent-card { background: var(--blue-bg); border: 0.5px solid var(--blue); border-radius: var(--radius-lg); padding: 1.25rem; }
.accent-card h3 { font-size: 14px; font-weight: 600; color: var(--blue); margin-bottom: 8px; }
.accent-card p  { font-size: 13px; color: var(--blue); line-height: 1.75; opacity: 0.9; }
.green-card { background: var(--green-bg); border: 0.5px solid var(--green); border-radius: var(--radius-lg); padding: 1.25rem; }
.green-card h3 { font-size: 14px; font-weight: 600; color: var(--green); margin-bottom: 8px; }
.green-card p  { font-size: 13px; color: var(--green); line-height: 1.75; opacity: 0.9; }

/* ── Group cards ── */
.group-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 1.5rem; }
.group-card {
  background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg);
  padding: 1rem; cursor: pointer; position: relative; overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1); box-shadow: var(--shadow-sm);
}
.group-card:hover { border-color: var(--blue); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(14,23,36,0.12); }
.group-card:hover .group-name::after { content: " →"; color: var(--text3); font-weight: 400; }
.group-row  { display: flex; justify-content: space-between; align-items: baseline; }
.group-name { font-size: 14px; font-weight: 600; color: var(--navy); }
.group-sub  { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ── Progress bar ── */
.progress-bar  { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  vertical-align: middle; white-space: nowrap; transition: opacity 0.15s;
}
.badge.present  { background: var(--green-bg); color: var(--green); border: 0.5px solid rgba(10,107,78,0.2); }
.badge.absent   { background: var(--red-bg);   color: var(--red);   border: 0.5px solid rgba(155,37,37,0.2); }
.badge.partial  { background: var(--amber-bg); color: var(--amber); border: 0.5px solid rgba(125,74,6,0.2); }
.badge.group-tag  { background: var(--blue-bg);   color: var(--blue);   font-size: 10px; }
.badge.nema-tag   { background: var(--purple-bg); color: var(--purple); font-size: 10px; }
.badge.meio-tag   { background: var(--teal-bg);   color: var(--teal);   font-size: 10px; }
.badge.marker-12s  { background: var(--blue-bg);   color: var(--blue);   font-size: 10px; }
.badge.marker-18s  { background: var(--purple-bg); color: var(--purple); font-size: 10px; }
.badge.marker-28s  { background: var(--teal-bg);   color: var(--teal);   font-size: 10px; }
.badge.marker-coi  { background: var(--amber-bg);  color: var(--amber);  font-size: 10px; }
.badge.marker-rbcl { background: var(--green-bg);  color: var(--green);  font-size: 10px; }

/* ── Controls ── */
.controls { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.controls input, .controls select {
  padding: 7px 12px; border: 0.5px solid var(--border2); border-radius: var(--radius);
  font-size: 13px; background: var(--bg); color: var(--text); outline: none;
}
.controls input { flex: 1; min-width: 160px; }
.controls input:focus, .controls select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(24,95,165,0.15); }

/* ── Table ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  background: linear-gradient(180deg, var(--bg2) 0%, #eff3fa 100%);
  color: var(--text2); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 10px 12px; border-bottom: 2px solid var(--border2);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
thead th:first-child { text-align: left; }
tbody tr { border-bottom: 0.5px solid var(--border); transition: background 0.1s; }
tbody tr:nth-child(even) { background: rgba(14,23,36,0.018); }
tbody tr:hover { background: #eef4ff; }
tbody td { padding: 8px 12px; vertical-align: middle; text-align: center; }
tbody td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: none; }
/* Only show pointer cursor on tables where rows are clickable */
.clickable-table tbody tr { cursor: pointer; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--blue); }
th.sortable::after { content: " ↕"; font-size: 10px; opacity: 0.4; }
th.sort-asc::after  { content: " ↑"; opacity: 0.8; color: var(--blue); }
th.sort-desc::after { content: " ↓"; opacity: 0.8; color: var(--blue); }

/* ── Priority / species labels ── */
.priority-high { color: var(--red);   font-size: 11px; font-weight: 700; text-transform: uppercase; }
.priority-med  { color: var(--amber); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.priority-low  { color: var(--text3); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.species-name  { font-style: italic; font-weight: 500; font-size: 12px; white-space: nowrap; }
td.eco-role    { font-size: 11px; color: var(--text2); max-width: 200px; }

/* ── Code blocks ── */
pre {
  background: #0d1117; border-radius: var(--radius); padding: 1.25rem;
  font-size: 12px; line-height: 1.65; overflow-x: auto; white-space: pre;
  color: #c9d1d9; border: 1px solid rgba(255,255,255,0.06);
}
.code-block-wrap { position: relative; margin-bottom: 1.5rem; }
.code-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.code-desc  { font-size: 12px; color: var(--text2); margin-bottom: 10px; line-height: 1.6; }
.copy-btn   { position: absolute; top: 2.2rem; right: 12px; padding: 6px 14px; font-size: 11px; cursor: pointer; border: none; border-radius: var(--radius); background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }
.copy-btn:hover { background: rgba(255,255,255,0.22); }

/* ── Step cards ── */
.step-card   { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 10px; }
.step-header { display: flex; align-items: center; gap: 10px; }
.step-num    { width: 24px; height: 24px; border-radius: 50%; background: var(--bg2); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text2); flex-shrink: 0; }
.step-title  { font-size: 14px; font-weight: 500; }
.step-desc   { font-size: 13px; color: var(--text2); margin-top: 8px; line-height: 1.55; padding-left: 34px; }
.step-links  { padding-left: 34px; margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Links & buttons ── */
.link-btn { display: inline-block; font-size: 12px; color: var(--blue); text-decoration: none; padding: 4px 10px; border: 0.5px solid var(--border2); border-radius: var(--radius); background: var(--blue-bg); }
.link-btn:hover { opacity: 0.8; }
a:not(.site-nav-btn):not(.popup-action) { transition: opacity 0.15s; }
a:not(.site-nav-btn):not(.popup-action):hover { opacity: 0.8; }
button, .submit-btn, .export-btn { cursor: pointer; font-family: inherit; transition: all 0.15s cubic-bezier(0.4,0,0.2,1); }
.submit-btn { padding: 10px 28px; background: var(--blue); color: #fff; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.submit-btn:hover { opacity: 0.85; }
.submit-btn:active { transform: scale(0.98); }
.export-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius); color: var(--text2); }
.export-btn::before { content: "⬇"; font-size: 11px; }
.export-btn:hover { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
.export-btn:active { transform: scale(0.98); }

/* ── Gap items ── */
.gap-list { font-size: 12px; color: var(--text2); line-height: 2; }
.gap-item { display: block; padding: 5px 0; font-size: 12px; color: var(--text2); border-bottom: 0.5px solid var(--border); transition: color 0.1s; }
.gap-item:hover { color: var(--blue); }
.gap-item:last-child { border-bottom: none; }
.gap-item em { color: var(--text); font-style: italic; }

/* ── Info pill ── */
.info-pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--bg2); color: var(--text2); border: 0.5px solid var(--border); margin-left: 6px; }

/* ── Active filter bar ── */
.active-filter-bar {
  display: none; align-items: center; gap: 10px;
  background: var(--blue-bg); border: 1px solid rgba(20,98,232,0.2);
  border-radius: var(--radius); padding: 8px 14px; margin-bottom: 1rem;
  font-size: 12px; color: var(--blue); transition: opacity 0.2s;
}
.active-filter-bar.visible { display: flex; animation: slideIn 0.15s ease; }
.clear-filter-btn {
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid rgba(20,98,232,0.3); background: rgba(20,98,232,0.08);
  color: var(--blue); font-size: 11px; cursor: pointer; font-family: inherit; font-weight: 500;
}

/* ── Section labels / heads ── */
.section-label { font-size: 11px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.section-head {
  font-size: 10.5px; font-weight: 800; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding-bottom: 8px; margin: 1.75rem 0 0.875rem;
  border-bottom: 1.5px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-head::before { content: ''; flex: none; width: 3px; height: 14px; background: var(--blue); border-radius: 2px; }

/* ── Page hero ── */
.page-hero { padding: 2.25rem 0 1.75rem; border-bottom: 1.5px solid var(--border); margin-bottom: 1.75rem; }
.page-hero h1 { font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: -0.025em; margin-bottom: 10px; }
.page-hero p  { font-size: 14.5px; color: var(--text2); max-width: 680px; }

/* ── Big numbers ── */
.big-number { font-size: 34px; font-weight: 700; color: var(--text); line-height: 1; }
.big-label  { font-size: 12px; color: var(--text2); margin-top: 4px; }
.db-stat { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }

/* ── Prose ── */
.prose { font-size: 14px; color: var(--text2); line-height: 1.8; max-width: 800px; }
.prose p { margin-bottom: 1rem; }
.prose strong { color: var(--text); font-weight: 500; }

/* ── Collab tags ── */
.collab-tag { display: inline-block; background: var(--blue-bg); color: var(--blue); border: 0.5px solid rgba(20,98,232,0.2); border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 500; margin: 2px; }

/* ── Timeline ── */
.timeline-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 0.5px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.t-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.t-dot.blue { background: var(--blue); } .t-dot.green { background: var(--green); } .t-dot.amber { background: var(--amber); }

/* ── Contact form ── */
.contact-form input, .contact-form textarea, .contact-form select {
  width: 100%; padding: 9px 12px; border: 0.5px solid var(--border2);
  border-radius: var(--radius); font-size: 13px; background: var(--bg);
  color: var(--text); outline: none; margin-bottom: 12px; font-family: inherit;
}
.contact-form input:focus, .contact-form textarea:focus, .contact-form select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 2px rgba(24,95,165,0.12);
}
.contact-form textarea { resize: vertical; min-height: 130px; }
.contact-form label { font-size: 12px; font-weight: 500; color: var(--text2); display: block; margin-bottom: 5px; }
.form-success { display: none; background: var(--green-bg); border: 0.5px solid var(--green); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; color: var(--green); margin-top: 10px; }

/* ── IUCN status badges ── */
.iucn-lc { background: #E1F5EE; color: #0F6E56; }
.iucn-nt { background: #E6F1FB; color: #185FA5; }
.iucn-vu { background: #FAEEDA; color: #854F0B; }
.iucn-en { background: #fde8d0; color: #a04000; }
.iucn-cr { background: #FCEBEB; color: #A32D2D; }
.iucn-ew { background: #f0e0f7; color: #6a0dad; }
.iucn-ex { background: #2d2d2d; color: #ffffff; }
.iucn-dd { background: #f0f0f0; color: #666666; }
.iucn-ne { background: #f5f5f3; color: #9a9a96; }

/* ── DOI elements ── */
.doi-block {
  background: linear-gradient(135deg, var(--blue-bg), var(--teal-bg));
  border: 1px solid rgba(20,98,232,0.2); border-left: 4px solid var(--blue);
  border-radius: var(--radius); padding: 14px 18px; font-size: 13px;
  font-style: italic; line-height: 1.9; box-shadow: 0 2px 8px rgba(20,98,232,0.07);
}
.doi-block a { font-style: normal; font-weight: 700; }
.doi-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-bg); color: var(--green);
  border: 1px solid rgba(10,107,78,0.2); border-radius: 8px;
  padding: 6px 14px; font-size: 12px; font-weight: 700;
  text-decoration: none; transition: all 0.15s;
}
.doi-badge:hover { background: var(--green); color: #fff; border-color: var(--green); }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; height: 12px;
}

/* ════════════════════════════════════════════════════════════════
   SITE HEADER
════════════════════════════════════════════════════════════════ */
.site-header {
  background: var(--bg); border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border), 0 4px 16px rgba(14,23,36,0.04);
}
.site-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.5rem 1rem;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap;
}
.site-title-block { flex: 1; min-width: 260px; }
.site-title    { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; line-height: 1.2; }
.site-subtitle { font-size: 13px; color: var(--text2); margin-top: 5px; }
.site-meta { font-size: 11px; color: var(--text3); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.site-meta-pill { display: inline-block; padding: 3px 10px; border-radius: 20px; background: var(--bg); border: 0.5px solid var(--border); white-space: nowrap; font-weight: 500; color: var(--blue); }
.site-badge-block { text-align: right; flex-shrink: 0; }
.site-badge { font-size: 11px; color: var(--blue); background: var(--blue-bg); border: 0.5px solid var(--blue); padding: 3px 10px; border-radius: 20px; display: inline-block; }

/* ════════════════════════════════════════════════════════════════
   GLOBAL SEARCH
════════════════════════════════════════════════════════════════ */
.search-wrap { position: relative; width: 100%; max-width: 560px; }
.search-input-row {
  display: flex; align-items: center; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: 24px; padding: 0 14px;
  gap: 8px; transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input-row:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,95,165,0.12); background: var(--bg); }
.search-input-row input { flex: 1; border: none; background: transparent; font-size: 13px; color: var(--text); padding: 9px 0; outline: none; }
.search-input-row input::placeholder { color: var(--text3); }
.search-clear { font-size: 16px; color: var(--text3); cursor: pointer; flex-shrink: 0; line-height: 1; display: none; }
.search-clear.visible { display: block; }
.search-clear:hover { color: var(--text); }
.search-dropdown {
  display: none; position: fixed; background: var(--bg);
  border: 1px solid var(--border2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 10001;
  max-height: 420px; overflow-y: auto; min-width: 340px; max-width: 420px;
}
.search-dropdown.open { display: block; }
.search-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 0.5px solid var(--border); transition: background 0.1s; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg2); }
.search-result-item.active { background: var(--blue-bg); }
.sri-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.sri-text { flex: 1; min-width: 0; }
.sri-name { font-size: 13px; font-style: italic; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sri-meta { font-size: 11px; color: var(--text2); margin-top: 1px; }
.sri-badge { font-size: 10px; font-weight: 500; padding: 1px 7px; border-radius: 20px; flex-shrink: 0; }
.search-section-label { padding: 6px 14px 3px; font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; background: var(--bg2); }
.search-no-results { padding: 16px 14px; font-size: 13px; color: var(--text2); text-align: center; }
.search-result-count { padding: 6px 14px; font-size: 11px; color: var(--text3); border-top: 0.5px solid var(--border); text-align: right; }

/* ════════════════════════════════════════════════════════════════
   SPECIES POPUP
════════════════════════════════════════════════════════════════ */
.popup-overlay { display: none; position: fixed; inset: 0; background: rgba(10,37,64,0.6); z-index: 10000; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.popup-overlay.open { display: flex; animation: fadeIn 0.18s ease; }
.popup-card { background: var(--bg); border-radius: 16px; width: 100%; max-width: 500px; max-height: min(84vh, 660px); display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(14,23,36,0.22), 0 0 0 1px rgba(14,23,36,0.08); overflow: hidden; }
.popup-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; background: var(--bg2); flex-shrink: 0; }
.popup-icon  { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.popup-title { flex: 1; min-width: 0; }
.popup-title h2 { font-size: 15px; font-weight: 700; font-style: italic; color: var(--navy); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-title p  { font-size: 12px; color: var(--text2); margin-top: 2px; }
.popup-close { width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--bg3); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text2); flex-shrink: 0; }
.popup-close:hover { background: #dee2e6; }
.popup-body { padding: 0.75rem 1.25rem; overflow-y: auto; flex: 1; }
.popup-row  { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.popup-row:last-child { border-bottom: none; }
.popup-row-label { color: var(--text2); font-weight: 500; }
.popup-row-val   { font-weight: 600; text-align: right; max-width: 60%; color: var(--navy); }
.popup-notes  { padding: 8px 1.25rem; font-size: 12px; color: var(--text2); line-height: 1.5; border-top: 1px solid var(--border); flex-shrink: 0; }
.popup-footer { padding: 8px 1.25rem; background: var(--bg2); border-top: 1px solid var(--border); display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.popup-action { font-size: 11px; padding: 5px 11px; border-radius: 7px; border: 1px solid var(--border2); background: var(--bg); color: var(--blue); cursor: pointer; font-weight: 500; font-family: inherit; transition: all 0.15s; }
.popup-action:hover { background: var(--blue-bg); border-color: var(--blue); }

/* ════════════════════════════════════════════════════════════════
   SITE NAV
════════════════════════════════════════════════════════════════ */
.site-nav {
  background: var(--bg); border-bottom: 1.5px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 12px rgba(14,23,36,0.06);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  overflow-x: auto; white-space: nowrap;
}
.site-nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; display: flex; gap: 0; }
.site-nav-group { position: relative; display: inline-block; }
.site-nav-btn {
  padding: 10px 14px; font-size: 12px; cursor: pointer; border: none;
  background: none; color: var(--text2); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; text-decoration: none;
  position: relative; font-weight: 500; transition: color 0.15s;
}
.site-nav-btn::after {
  content: ''; position: absolute; bottom: -1.5px; left: 14px; right: 14px;
  height: 2.5px; background: var(--blue); border-radius: 2px;
  transform: scaleX(0); transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}
.site-nav-btn:hover { color: var(--navy); }
.site-nav-btn.nav-pg-active { color: var(--blue) !important; font-weight: 600 !important; }
.site-nav-btn.nav-pg-active::after { transform: scaleX(1); }

/* ── Single-file dashboard page sections (compat) ── */
.page-section { display: none; }
.page-section.pg-active { display: block; animation: panelIn 0.22s ease; }

/* ════════════════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════════════════ */
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.footer a { color: #8cb4ff; text-decoration: none; }
.footer a:hover, footer a:hover { opacity: 0.88 !important; }
.subscribe-box { display: flex; gap: 8px; margin-top: 12px; }
.subscribe-box input  { padding: 10px 14px; border-radius: 6px; border: none; outline: none; flex: 1; font-size: 13px; }
.subscribe-box button { padding: 10px 16px; background: #185FA5; color: #fff; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; }
.footer-bottom { max-width: 1200px; margin: 1rem auto 0; padding: 0.75rem 1.5rem 0; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-size: 11px; color: rgba(255,255,255,0.4); }

/* ════════════════════════════════════════════════════════════════
   DARK MODE
════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181f; --bg2: #1a2230; --bg3: #1f2937;
    --text: #e8edf5; --text2: #94a3b8; --text3: #64748b;
    --border: rgba(255,255,255,0.08); --border2: rgba(255,255,255,0.15);
    --green-bg: #052e22; --green: #34d399;
    --red-bg:   #2d1010; --red:   #f87171;
    --amber-bg: #2d1a00; --amber: #fbbf24;
    --blue-bg:  #0d1f3c; --blue:  #60a5fa;
    --purple-bg:#1e1040; --purple:#c084fc;
    --teal-bg:  #052e2e; --teal:  #2dd4bf;
    --navy: #e8edf5;
  }
  pre { background: #0d1117; color: #c9d1d9; }
  .copy-btn { background: rgba(255,255,255,0.08); }
  .info-card h3 { color: var(--text); }
  .page-hero h1 { color: var(--text); }
  .group-name { color: var(--text); }
  .species-name { color: var(--text); }
  .popup-title h2 { color: var(--text); }
  .popup-row-val { color: var(--text); }
  footer { background: #0a1628 !important; }
  tbody tr:hover { background: #1e2d42; }
  thead th { background: linear-gradient(180deg, var(--bg2) 0%, var(--bg3) 100%); }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .site-header-inner { padding: 1rem; gap: 0.75rem; }
  .site-title    { font-size: 16px !important; }
  .site-subtitle { font-size: 12px !important; }
  .site-badge-block { min-width: auto !important; max-width: 100% !important; width: 100%; }
  .search-wrap { max-width: 100% !important; }
  .three-col, .two-col { grid-template-columns: 1fr !important; }
  .stat-grid  { grid-template-columns: repeat(2, 1fr) !important; }
  .group-grid { grid-template-columns: repeat(2, 1fr) !important; }
  #db-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .page-hero h1 { font-size: 22px !important; }
  .controls { flex-direction: column !important; }
  .controls input, .controls select { width: 100%; }
  .footer-grid  { grid-template-columns: 1fr !important; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .popup-card { margin: 0.5rem; border-radius: 12px; }
  table { font-size: 11.5px; }
  tbody td { padding: 6px 8px; }
}
@media (max-width: 700px) {
  .stat-grid  { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .stat-grid  { grid-template-columns: repeat(2, 1fr) !important; }
  .group-grid { grid-template-columns: 1fr !important; }
  #db-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .tab  { padding: 8px 12px !important; font-size: 11.5px !important; }
  .tabs { gap: 0 !important; }
  .popup-card { max-height: 90vh; border-radius: 10px; }
}
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr !important; }
}

/* ════════════════════════════════════════════════════════════════
   PRINT
════════════════════════════════════════════════════════════════ */
@media print {
  .site-header, .site-nav, .controls, .export-btn, footer,
  .popup-overlay, #back-to-top { display: none !important; }
  body { font-size: 11pt; color: #000; }
  a { color: #000; text-decoration: underline; }
  table { page-break-inside: avoid; }
  .page-section { display: block !important; page-break-before: always; }
  #main-content { display: block !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .tab { display: none; }
  .panel { display: block !important; }
}
