/* ============================================================
   Malva Explorer 2  —  Design system
   Bootstrap 5.3 base  ·  Clean professional theme
   ============================================================ */

/* ── CSS custom properties ──────────────────────────────────── */
:root {
  --mv-primary:       #6d28d9;   /* Malva purple */
  --mv-primary-dark:  #5b21b6;
  --mv-primary-light: #ede9fe;
  --mv-primary-text:  #ffffff;

  --mv-border:        #e5e7eb;
  --mv-border-strong: #d1d5db;
  --mv-bg:            #f8f9fa;
  --mv-surface:       #ffffff;
  --mv-text:          #111827;
  --mv-text-muted:    #6b7280;
  --mv-text-lighter:  #9ca3af;

  --mv-success:       #16a34a;
  --mv-warning:       #d97706;
  --mv-danger:        #dc2626;

  /* Whisker / expression colours */
  --mv-expr-0: #f0f9ff;
  --mv-expr-1: #bae6fd;
  --mv-expr-2: #38bdf8;
  --mv-expr-3: #0284c7;
  --mv-expr-4: #0c4a6e;

  --mv-nav-height: 56px;
  --mv-panel-width: 220px;
  --mv-detail-height: 50vh;

  --mv-radius:   6px;
  --mv-radius-lg: 10px;
}


/* ── Base ────────────────────────────────────────────────────── */
body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--mv-bg);
  color: var(--mv-text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--mv-primary); }
code { font-family: 'DM Mono', ui-monospace, "SFMono-Regular", monospace; font-size: .85em; color: var(--mv-primary-dark); }
pre  { font-family: 'DM Mono', ui-monospace, "SFMono-Regular", monospace; }


/* ── Navigation ──────────────────────────────────────────────── */
.mv-navbar {
  background: var(--mv-surface);
  border-bottom: 1px solid var(--mv-border);
  height: var(--mv-nav-height);
  z-index: 1000;
  position: sticky;
  top: 0;
}

.mv-brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--mv-text) !important;
  text-decoration: none;
}
@keyframes mv-logo-breathe {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(124,58,237,.45)); }
  50%       { filter: drop-shadow(0 0 9px rgba(124,58,237,.75)) drop-shadow(0 0 18px rgba(124,58,237,.18)); }
}
.mv-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  filter: drop-shadow(0 0 4px rgba(124,58,237,.45));
  animation: mv-logo-breathe 3.5s ease-in-out infinite;
}
.mv-brand-icon-lg {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 12px;
}
.mv-brand-name {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--mv-text);
  letter-spacing: -0.01em;
}

.mv-navbar .nav-link {
  color: var(--mv-text-muted);
  font-size: .875rem;
  padding: .35rem .6rem;
  border-radius: var(--mv-radius);
  transition: color .15s, background .15s;
}
.mv-navbar .nav-link:hover { color: var(--mv-text); background: var(--mv-primary-light); }
.mv-navbar .nav-link.active {
  color: var(--mv-primary);
  font-weight: 600;
  background: var(--mv-primary-light);
}


/* ── Status dot ──────────────────────────────────────────────── */
.mv-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mv-text-lighter);
  display: inline-block;
  flex-shrink: 0;
  cursor: default;
  transition: background .3s;
}
.mv-status-dot[data-status="ok"]       { background: var(--mv-success); }
.mv-status-dot[data-status="degraded"] { background: var(--mv-warning); }
.mv-status-dot[data-status="offline"]  { background: var(--mv-danger); }


/* ── Buttons ─────────────────────────────────────────────────── */
.mv-btn-primary {
  background: var(--mv-primary);
  border-color: var(--mv-primary);
  color: white;
}
.mv-btn-primary:hover, .mv-btn-primary:focus {
  background: var(--mv-primary-dark);
  border-color: var(--mv-primary-dark);
  color: white;
}
.mv-btn-primary:disabled {
  background: var(--mv-text-lighter);
  border-color: var(--mv-text-lighter);
}

.mv-btn-orcid {
  background: #a6ce39;
  border-color: #a6ce39;
  color: #333;
  font-weight: 600;
}
.mv-btn-orcid:hover {
  background: #95ba32;
  border-color: #95ba32;
  color: #333;
}

.btn-xs {
  padding: .15rem .35rem;
  font-size: .75rem;
  line-height: 1.4;
  border-radius: 4px;
}


/* ── Flash messages ──────────────────────────────────────────── */
.mv-flash-container {
  position: fixed;
  top: calc(var(--mv-nav-height) + 8px);
  right: 16px;
  z-index: 2000;
  width: 340px;
}
.mv-flash {
  font-size: .875rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}


/* ── Main content ────────────────────────────────────────────── */
.mv-main {
  min-height: calc(100vh - var(--mv-nav-height));
}


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


/* ── Home page ────────────────────────────────────────────────── */
.mv-eyebrow {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mv-primary);
}
.mv-divider { border-color: var(--mv-border); }

.mv-home-wrap { padding-top: 3.5rem; padding-bottom: 4rem; }

.mv-home-top { margin-bottom: 2.75rem; }

.mv-hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.16;
  color: var(--mv-text);
  letter-spacing: -.02em;
}
.mv-hero-sub {
  color: var(--mv-text-muted);
  font-size: .95rem;
  line-height: 1.65;
}

/* ── Flow animation SVG ─────────────────────────────────────────────────── */
.mv-flow-svg {
  width: 100%;
  display: block;
}
/* SVG text labels */
.mv-flow-lbl {
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 500;
  fill: #9ca3af;
  letter-spacing: .2px;
}
/* Stats header (section title, e.g. "Public sources") */
.mv-flow-sh {
  font-family: inherit;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  fill: #9ca3af;
}
/* Stats header — purple accent for center column */
.mv-flow-sh-p {
  fill: #7c3aed;
  fill-opacity: .6;
}
/* Stats value (large number) */
.mv-flow-sv {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  fill: #1f2937;
}
/* Stats value — purple accent for center column */
.mv-flow-sv-p {
  fill: #7c3aed;
}
/* Stats sub-label (e.g. "datasets", "samples") */
.mv-flow-sl {
  font-family: inherit;
  font-size: 7.5px;
  font-weight: 400;
  fill: #9ca3af;
}
/* DNA sequence text flowing along paths */
.mv-flow-seq {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "Fira Mono", monospace;
  font-size: 7.5px;
  font-weight: 500;
  fill: #7c3aed;
  letter-spacing: 1.2px;
}
.mv-flow-lbl-center {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  fill: #7c3aed;
  fill-opacity: .55;
}
.mv-flow-lbl-cells {
  font-size: 11px;
  font-weight: 500;
  fill: #6b7280;
}

/* ── Stats strip ────────────────────────────────────────────────────────── */
.mv-home-stats {
  display: flex;
  align-items: stretch;
  background: var(--mv-surface);
  border: 1px solid var(--mv-border);
  border-radius: var(--mv-radius-lg);
  overflow: hidden;
}
.mv-home-stat {
  flex: 1;
  padding: 1.1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mv-home-stat-value {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--mv-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mv-home-stat-label {
  font-size: .74rem;
  color: var(--mv-text-muted);
  font-weight: 400;
}
.mv-home-stat-sep {
  width: 1px;
  background: var(--mv-border);
  margin: .85rem 0;
  flex-shrink: 0;
}

/* ── Home explorer cards ────────────────────────────────────────────────── */
.mv-explorer-card {
  display: flex;
  flex-direction: column;
  padding: 2.25rem 2.5rem;
  border-radius: var(--mv-radius-lg);
  border: 1px solid var(--mv-border);
  background: var(--mv-surface);
  text-decoration: none;
  color: var(--mv-text);
  transition: box-shadow .18s, transform .18s;
  height: 100%;
}
.mv-explorer-card:hover {
  text-decoration: none;
  color: var(--mv-text);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.07);
}
.mv-explorer-expression { border-top: 3px solid var(--mv-primary); }
.mv-explorer-coverage   { border-top: 3px solid #0d9488; }

.mv-explorer-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.mv-explorer-icon-primary { background: var(--mv-primary-light); color: var(--mv-primary); }
.mv-explorer-icon-teal    { background: #ccfbf1; color: #0d9488; }

.mv-explorer-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .6rem;
  color: var(--mv-text);
}
.mv-explorer-desc {
  font-size: .875rem;
  color: var(--mv-text-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1.5rem;
}
.mv-explorer-cta {
  font-size: .82rem;
  font-weight: 600;
  color: var(--mv-primary);
  margin-top: auto;
}
.mv-explorer-cta-teal { color: #0d9488; }
.mv-explorer-card:hover .mv-explorer-cta  { text-decoration: underline; }
.mv-explorer-card:hover .mv-explorer-cta-teal { text-decoration: underline; }

/* Responsive */
@media (max-width: 640px) {
  .mv-hero-title { font-size: 1.9rem; }
  .mv-home-stats { flex-direction: column; }
  .mv-home-stat-sep { width: auto; height: 1px; margin: 0 1.5rem; }
}


/* ── Explorer layout ─────────────────────────────────────────── */
.mv-explorer-layout {
  display: flex;
  height: calc(100vh - var(--mv-nav-height));
  overflow: hidden;
}
.mv-explorer-layout.mv-has-banner {
  height: calc(100vh - var(--mv-nav-height) - 38px);
}

/* ── Artifact / control panel ────────────────────────────────── */
.mv-artifact-panel {
  width: var(--mv-panel-width);
  min-width: var(--mv-panel-width);
  background: var(--mv-surface);
  border-right: 1px solid var(--mv-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mv-panel-header {
  display: flex;
  align-items: center;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--mv-border);
  gap: .5rem;
  flex-shrink: 0;
  min-height: 40px;
  box-sizing: border-box;
}

.mv-panel-footer {
  padding: .5rem .75rem;
  border-top: 1px solid var(--mv-border);
  flex-shrink: 0;
  line-height: 1.4;
}

.mv-panel-divider {
  border-top: 1px solid var(--mv-border);
  flex-shrink: 0;
}

.mv-artifact-list {
  flex: 1;
  overflow-y: auto;
  padding: .25rem;
}

.mv-artifact-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  height: 100%;
}

/* Individual artifact item */
.mv-artifact-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .5rem;
  border-radius: var(--mv-radius);
  cursor: default;
  transition: background .1s;
  position: relative;
}
.mv-artifact-item:hover { background: var(--mv-bg); }
.mv-artifact-item.active { background: var(--mv-primary-light); }

/* Hidden state — visually distinct without Bootstrap opacity hack */
.mv-artifact-item.mv-artifact-hidden { background: transparent; }
.mv-artifact-item.mv-artifact-hidden .mv-artifact-name {
  color: var(--mv-text-lighter);
  text-decoration: line-through;
}
.mv-artifact-item.mv-artifact-hidden .mv-artifact-dot {
  opacity: .35;
}

.mv-artifact-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: opacity .15s;
}

.mv-artifact-name {
  font-size: .8rem;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .15s;
}

.mv-artifact-status {
  font-size: .7rem;
  color: var(--mv-text-lighter);
}

/* Clean icon-only button for artifact actions */
.mv-artifact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  padding: 0;
  border-radius: 3px;
  color: var(--mv-text-lighter);
  cursor: pointer;
  transition: color .12s, background .12s;
  flex-shrink: 0;
}
.mv-artifact-btn:hover { color: var(--mv-text); background: var(--mv-border); }
.mv-artifact-btn:focus-visible { outline: 2px solid var(--mv-primary); outline-offset: 1px; }

.mv-artifact-job-header {
  font-size: .7rem;
  font-weight: 600;
  color: var(--mv-text-muted);
  padding: .4rem .5rem .15rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.mv-artifact-job-group { border-top: 1px solid var(--mv-border); padding-top: .25rem; }
.mv-artifact-job-group:first-child { border-top: none; padding-top: 0; }

/* Artifact hover tooltip */
.mv-artifact-tooltip {
  position: fixed;
  z-index: 9000;
  background: var(--mv-text);
  color: #fff;
  border-radius: var(--mv-radius);
  padding: .5rem .7rem;
  font-size: .75rem;
  line-height: 1.5;
  pointer-events: none;
  max-width: 220px;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.mv-artifact-tooltip-name {
  font-weight: 600;
  font-size: .8rem;
  margin-bottom: .2rem;
}
.mv-artifact-tooltip-row {
  color: rgba(255,255,255,.75);
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}
.mv-artifact-tooltip-row span:last-child { color: #fff; font-weight: 500; }

/* ── Table area ──────────────────────────────────────────────── */
.mv-table-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.mv-table-toolbar {
  padding: .5rem .75rem;
  background: var(--mv-surface);
  border-bottom: 1px solid var(--mv-border);
  flex-shrink: 0;
  min-height: 40px;
  box-sizing: border-box;
}

.mv-table-enrich-row {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.mv-table-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  min-width: 0;
}

.mv-table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 2rem;
}

/* ── Expression table ────────────────────────────────────────── */
.mv-expr-table {
  font-size: .8rem;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: auto;
  min-width: 100%;
}

.mv-expr-table thead th {
  position: sticky;
  top: 0;
  background: var(--mv-surface);
  border-bottom: 2px solid var(--mv-border-strong);
  white-space: nowrap;
  padding: .45rem .6rem;
  font-weight: 600;
  font-size: .75rem;
  color: var(--mv-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  z-index: 10;
}

.mv-expr-table thead th.th-expr {
  color: var(--mv-primary);
  width: 110px;
  overflow: hidden;
}
.mv-expr-table thead th.th-meta {
  width: 150px;
  overflow: hidden;
}
.mv-expr-table thead th.th-expand { width: 36px; }

/* Column group separator */
.mv-expr-table thead th.th-group-start {
  border-left: 2px solid var(--mv-border-strong);
}

/* Sortable header */
.mv-expr-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.mv-expr-table thead th.sortable:hover { color: var(--mv-text); }
.mv-expr-table thead th.sort-asc::after  { content: ' ↑'; }
.mv-expr-table thead th.sort-desc::after { content: ' ↓'; }

/* Filter chip in header */
.mv-col-filter-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--mv-text-lighter);
  font-size: .75rem;
  cursor: pointer;
  margin-left: 2px;
  vertical-align: middle;
}
.mv-col-filter-btn:hover, .mv-col-filter-btn.active { color: var(--mv-primary); }

/* Body rows */
.mv-expr-table tbody tr {
  transition: background .1s;
}
.mv-expr-table tbody tr.expanded {
  background: var(--mv-primary-light) !important;
}
.mv-expr-table tbody td {
  padding: .3rem .6rem;
  border-bottom: 1px solid var(--mv-border);
  vertical-align: middle;
}
.mv-expr-table tbody td.td-group-start {
  border-left: 2px solid var(--mv-border-strong);
}
.mv-expr-table tbody td.td-expand {
  width: 36px;
  text-align: center;
}

/* ── Display mode cards ───────────────────────────────────────── */
.mv-mode-card {
  padding: .5rem .6rem;
  border: 1px solid var(--mv-border);
  border-radius: var(--mv-radius);
  margin-bottom: .35rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.mv-mode-card:hover { border-color: var(--mv-primary); background: var(--mv-bg); }
.mv-mode-card.active {
  border-color: var(--mv-primary);
  background: var(--mv-primary-light);
  box-shadow: inset 3px 0 0 var(--mv-primary);
}
.mv-mode-card-title {
  font-size: .78rem;
  font-weight: 600;
  color: var(--mv-text);
  margin-bottom: .15rem;
}
.mv-mode-card.active .mv-mode-card-title { color: var(--mv-primary-dark); }
.mv-mode-card-desc {
  font-size: .65rem;
  color: var(--mv-text-muted);
  line-height: 1.3;
}

/* ── Compact mode ─────────────────────────────────────────────── */
.mv-compact-mode .mv-expr-table {
  table-layout: fixed;
  width: 100% !important;
  min-width: 0 !important;
}
.mv-compact-mode .mv-expr-table thead th {
  min-width: 0 !important;
  width: auto !important;
}
.mv-compact-mode .mv-expr-table thead th.th-meta {
  min-width: 0 !important;
  width: auto !important;
}
.mv-compact-row td {
  border-bottom: none !important;
  border-top: 1px solid rgba(0,0,0,.03) !important;
  padding: 0 !important;
}
.mv-compact-row:hover {
  outline: 2px solid var(--mv-primary);
  outline-offset: -2px;
  z-index: 1;
  position: relative;
}

/* Floating tooltip for compact mode */
.mv-compact-tooltip {
  position: absolute;
  z-index: 10000;
  background: white;
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: .6rem .8rem;
  font-size: .75rem;
  max-width: 320px;
  pointer-events: none;
  line-height: 1.5;
  display: none;
}

/* Expand toggle button */
.mv-expand-btn {
  background: none;
  border: 1px solid var(--mv-border-strong);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--mv-text-muted);
  cursor: pointer;
  font-size: .7rem;
  transition: background .1s, color .1s;
}
.mv-expand-btn:hover, .mv-expand-btn.open {
  background: var(--mv-primary-light);
  color: var(--mv-primary);
  border-color: var(--mv-primary);
}

/* Metadata cell */
.td-meta-cell {
  font-size: .8rem;
  color: var(--mv-text);
  overflow: hidden;
  max-width: 0; /* lets table-layout:fixed control the width */
}

/* Truncated text inside a metadata cell — click to expand */
.mv-cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.mv-cell-text.mv-cell-expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  cursor: default;
  user-select: text;
}
.td-meta-link { color: var(--mv-primary); text-decoration: none; }
.td-meta-link:hover { text-decoration: underline; }

/* ── Whisker SVG cell ────────────────────────────────────────── */
.mv-whisker-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  height: 32px;
}

.mv-whisker-cell svg {
  display: block;
  overflow: visible;
}

/* Whisker SVG elements (styled via JS attributes, not CSS for values) */
.wk-range { stroke: #cbd5e1; stroke-width: 1.5; stroke-linecap: round; }
.wk-iqr   { stroke: #94a3b8; stroke-width: 3; stroke-linecap: round; }
.wk-dot   { /* fill and r set programmatically */ }

/* ── Detail panel (expanded row) ────────────────────────────── */
.mv-detail-panel {
  position: fixed;
  bottom: 0;
  left: var(--mv-panel-width);
  right: 0;
  height: var(--mv-detail-height);
  background: var(--mv-surface);
  border-top: 2px solid var(--mv-primary);
  z-index: 500;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0,0,0,.08);
}

.mv-detail-header {
  display: flex;
  align-items: center;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--mv-border);
  gap: .5rem;
  flex-shrink: 0;
  font-size: .875rem;
}

.mv-detail-body {
  flex: 1;
  overflow: hidden;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mv-detail-chart {
  background: var(--mv-bg);
  border: 1px solid var(--mv-border);
  border-radius: var(--mv-radius);
  overflow: hidden;
}

.mv-umap-container {
  background: #1a1a2e;
  border-radius: var(--mv-radius);
  overflow: hidden;
}

/* When detail panel open, shrink table area */
.detail-open .mv-table-wrapper {
  padding-bottom: var(--mv-detail-height);
}

/* ── Column picker ────────────────────────────────────────────── */
.mv-column-picker-list {
  max-height: 400px;
  overflow-y: auto;
}

/* Enrichment cell colors */
.td-enriched-strong { background: #dcfce7 !important; }
.td-enriched       { background: #f0fdf4 !important; }
.td-depleted-strong { background: #fef2f2 !important; }
.td-depleted       { background: #fef9f9 !important; }

/* ── Enrichment side panel ────────────────────────────────────── */
.mv-enrichment-panel {
  width: 240px;
  min-width: 240px;
  border-left: 1px solid var(--mv-border);
  background: var(--mv-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.mv-enrichment-panel-header {
  display: flex;
  align-items: center;
  padding: .4rem .6rem;
  border-bottom: 1px solid var(--mv-border);
  gap: .3rem;
  flex-shrink: 0;
}
.mv-enrichment-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: .5rem;
  font-size: .72rem;
}

.mv-enrich-group {
  margin-bottom: .5rem;
}
.mv-enrich-group-label {
  font-weight: 600;
  color: var(--mv-primary);
  font-size: .65rem;
  margin-bottom: .2rem;
  padding-bottom: .15rem;
  border-bottom: 1px solid var(--mv-border);
}

/* Enrichment bar items */
.mv-enrich-item {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem 0;
  cursor: pointer;
  border-radius: 3px;
  transition: background .1s;
}
.mv-enrich-item:hover { background: var(--mv-primary-light); }
.mv-enrich-item-name {
  flex: 1;
  font-size: .68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mv-enrich-item-bar {
  width: 50px;
  height: 8px;
  background: var(--mv-border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.mv-enrich-item-bar-fill {
  height: 100%;
  border-radius: 2px;
}
.mv-enrich-item-fold {
  font-size: .6rem;
  min-width: 28px;
  text-align: right;
  font-weight: 600;
}

.mv-column-picker-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: .8rem;
  transition: background .1s;
}
.mv-column-picker-item:hover { background: var(--mv-bg); }
.mv-column-picker-item input[type="checkbox"] {
  cursor: pointer;
}


/* ── Filter dropdown (per-column) ─────────────────────────────── */
.mv-filter-dropdown {
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
}

.mv-filter-search {
  padding: .35rem .5rem;
  border: none;
  border-bottom: 1px solid var(--mv-border);
  width: 100%;
  font-size: .8rem;
  outline: none;
  background: var(--mv-bg);
}

.mv-filter-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .6rem;
  cursor: pointer;
  font-size: .8rem;
  transition: background .1s;
}
.mv-filter-item:hover { background: var(--mv-bg); }
.mv-filter-item input[type="checkbox"] { cursor: pointer; }
.mv-filter-count {
  margin-left: auto;
  font-size: .7rem;
  color: var(--mv-text-lighter);
  background: var(--mv-bg);
  border-radius: 10px;
  padding: 0 .4rem;
}


/* ── Coverage tracks ──────────────────────────────────────────── */
.mv-cov-ruler {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--mv-surface);
}

.mv-cov-track-row:hover {
  background: var(--mv-primary-light) !important;
}

.mv-cov-track-label {
  border-right: 1px solid var(--mv-border);
  background: var(--mv-surface);
}

.mv-cov-filter-item {
  gap: .35rem;
}

/* Mini coverage track SVG */
.mv-coverage-track {
  display: block;
  width: 200px;
  height: 32px;
}

/* Greyed-out filter value (not in results) */
.mv-filter-item.not-in-results .mv-filter-label { color: var(--mv-text-lighter); }
.mv-filter-item.not-in-results .mv-filter-count {
  background: transparent;
  color: var(--mv-text-lighter);
}


/* ── Progress bar ─────────────────────────────────────────────── */
.mv-progress { border-radius: 2px; background: var(--mv-border); }
.mv-progress .progress-bar { background: var(--mv-primary); }


/* ── Auth card ────────────────────────────────────────────────── */
.mv-auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--mv-surface);
  border: 1px solid var(--mv-border);
  border-radius: var(--mv-radius-lg);
  padding: 2rem;
}

.mv-divider-text {
  position: relative;
  text-align: center;
  color: var(--mv-text-muted);
  font-size: .8rem;
}
.mv-divider-text::before,
.mv-divider-text::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--mv-border);
}
.mv-divider-text::before { left: 0; }
.mv-divider-text::after  { right: 0; }


/* ── Badges ───────────────────────────────────────────────────── */
.mv-badge-account {
  background: var(--mv-primary-light);
  color: var(--mv-primary-dark);
  border: 1px solid var(--mv-primary);
  font-weight: 500;
}


/* ── Utilities ────────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.form-select-xs {
  font-size: .75rem;
  padding: .15rem .5rem;
  border-radius: 4px;
}
.font-monospace { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.last-no-border:last-child { border-bottom: none !important; }

/* ── Legends ──────────────────────────────────────────────────── */
/* ── Search result stats bar ──────────────────────────────────────────────── */
.mv-stats-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .28rem .75rem;
  background: var(--mv-surface);
  border-bottom: 1px solid var(--mv-border);
  font-size: .72rem;
  color: var(--mv-text-muted);
  flex-shrink: 0;
}
.mv-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  background: var(--mv-bg);
  border: 1px solid var(--mv-border);
  border-radius: 20px;
  padding: 1px 8px;
  white-space: nowrap;
  font-size: .7rem;
}
.mv-stat-chip b { color: var(--mv-text); font-weight: 600; }
.mv-stat-chip-projects {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.mv-stat-chip-projects:hover { background: var(--mv-primary-light); border-color: var(--mv-primary); color: var(--mv-primary); }
.mv-stat-chip-projects:hover b { color: var(--mv-primary); }
.mv-stat-chip-arrow { font-size: .6rem; opacity: .7; }
.mv-stat-projects-popup {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9900;
  background: var(--mv-surface);
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
  padding: 8px 10px;
  min-width: 200px;
  max-width: 360px;
  max-height: 280px;
  overflow-y: auto;
}
.mv-stat-projects-popup.open { display: block; }
.mv-stat-proj-tag {
  display: inline-block;
  background: var(--mv-primary-light);
  color: var(--mv-primary);
  border: 1px solid rgba(109,40,217,.15);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: .68rem;
  margin: 2px 3px 2px 0;
  font-family: monospace;
}
.mv-stats-sep { color: var(--mv-border); font-size: .9rem; }

.mv-legend-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .25rem .75rem;
  background: var(--mv-surface);
  border-bottom: 1px solid var(--mv-border);
  font-size: .7rem;
  color: var(--mv-text-muted);
  flex-shrink: 0;
}

.mv-legend-item {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.mv-legend-gradient {
  width: 60px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid var(--mv-border);
}

.mv-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,.1);
  flex-shrink: 0;
}

.mv-legend-circle {
  border-radius: 50%;
}

/* Expression heatmap gradient */
.mv-legend-expr {
  background: linear-gradient(90deg, #f0f9ff, #bae6fd, #38bdf8, #0284c7, #0c4a6e);
}

/* Enrichment legend swatches */
.mv-legend-enriched { background: #dcfce7; }
.mv-legend-depleted { background: #fef2f2; }

/* ── Table header section colors ─────────────────────────────── */
/* Scale row: positioned by JS after measuring header height */
.mv-scale-row th {
  position: sticky;
  z-index: 9;
  border-bottom: 1px solid var(--mv-border) !important;
}

.mv-expr-table thead th.th-expr {
  color: var(--mv-primary);
  width: 110px;
  overflow: hidden;
  background: var(--mv-surface);
}
.mv-expr-table thead th.th-meta {
  width: 150px;
  overflow: hidden;
  background: var(--mv-surface);
}
.mv-expr-table thead th.th-cells {
  background: var(--mv-surface);
}

/* ── Detail panel section headers ────────────────────────────── */
.mv-detail-header {
  display: flex;
  align-items: center;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--mv-border);
  gap: .5rem;
  flex-shrink: 0;
  font-size: .875rem;
  background: var(--mv-surface);
}

/* ── Global top progress bar ──────────────────────────────────── */
.mv-global-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
}
.mv-global-progress-bar {
  height: 100%;
  background: var(--mv-primary);
  width: 0%;
  animation: mv-progress-indeterminate 1.5s ease-in-out infinite;
  border-radius: 0 2px 2px 0;
}
@keyframes mv-progress-indeterminate {
  0% { width: 0%; margin-left: 0%; }
  50% { width: 40%; margin-left: 30%; }
  100% { width: 0%; margin-left: 100%; }
}

/* ── Minimap (VSCode-style scroll overview) ──────────────────── */
.mv-minimap {
  width: 48px;
  min-width: 48px;
  background: var(--mv-bg);
  border-left: 1px solid var(--mv-border);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}
.mv-minimap canvas {
  display: block;
}
.mv-minimap-viewport {
  transition: top .05s;
}

/* ── Loading overlay ──────────────────────────────────────────── */
.mv-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.7);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  pointer-events: none;
  backdrop-filter: blur(1px);
  transition: opacity .15s;
}
.mv-loading-content {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  padding: .5rem 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

/* Scrollbar styling (webkit) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--mv-border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--mv-text-lighter); }

/* ── Error pages ──────────────────────────────────────────────── */
.mv-error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--mv-nav-height));
  padding: 2rem 1rem;
  background: var(--mv-bg);
}

.mv-error-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  text-align: center;
}

.mv-error-stripe {
  height: 4px;
  background: var(--mv-primary);
}

.mv-error-body {
  padding: 2.5rem 2rem 2rem;
}

.mv-error-code {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -3px;
  color: var(--mv-primary);
  margin-bottom: .5rem;
}

.mv-error-icon-wrap {
  width: 56px;
  height: 56px;
  background: var(--mv-primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.mv-error-icon {
  font-size: 1.5rem;
  color: var(--mv-primary);
}

.mv-error-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--mv-text);
}

.mv-error-desc {
  color: var(--mv-text-muted);
  font-size: .9rem;
  margin-bottom: 0;
}

.mv-error-detail {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: .8rem;
  color: #b91c1c;
  text-align: left;
  font-family: monospace;
  word-break: break-word;
}

/* ── Cells column (narrow) ────────────────────────────────────── */
.mv-expr-table thead th.th-cells {
  width: 64px;
  overflow: hidden;
  background: var(--mv-surface);
}

/* ── Numeric histogram filter panel ──────────────────────────── */
.mv-num-filter-wrap {
  padding: .75rem .75rem .5rem;
  min-width: 260px;
}
.mv-num-filter-canvas {
  display: block;
  width: 100%;
  border-radius: 4px;
  background: var(--mv-bg);
  margin-bottom: .5rem;
}
.mv-num-slider-track {
  position: relative;
  height: 20px;
  margin-bottom: .5rem;
}
.mv-num-slider-fill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: var(--mv-primary);
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
}
.mv-num-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
  z-index: 2;
}
.mv-num-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--mv-border-strong);
  border-radius: 2px;
}
.mv-num-slider::-moz-range-track {
  height: 4px;
  background: var(--mv-border-strong);
  border-radius: 2px;
}
.mv-num-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--mv-primary);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: grab;
  pointer-events: all;
  margin-top: -6px;
}
.mv-num-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--mv-primary);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: grab;
  pointer-events: all;
}
.mv-num-slider:active::-webkit-slider-thumb { cursor: grabbing; }
.mv-num-slider:active::-moz-range-thumb    { cursor: grabbing; }
.mv-num-inputs {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}
.mv-num-input {
  flex: 1;
  min-width: 0;
  font-size: .78rem;
  padding: .2rem .4rem;
  border: 1px solid var(--mv-border-strong);
  border-radius: 4px;
  text-align: center;
}
.mv-num-input:focus {
  outline: none;
  border-color: var(--mv-primary);
  box-shadow: 0 0 0 2px var(--mv-primary-light);
}
.mv-num-sep {
  font-size: .75rem;
  color: var(--mv-text-muted);
  flex-shrink: 0;
}

/* ── Share panel (floating popover) ─────────────────────────────── */
.mv-share-panel {
  position: absolute;
  z-index: 2000;
  background: white;
  border: 1px solid var(--mv-border-strong);
  border-radius: var(--mv-radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: .75rem;
  width: 300px;
}
.mv-share-panel-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--mv-text);
  margin-bottom: .5rem;
}
.mv-share-url-row {
  display: flex;
  gap: .4rem;
  align-items: center;
  margin-bottom: .35rem;
}
.mv-share-url-input {
  flex: 1;
  min-width: 0;
  font-size: .7rem !important;
  background: var(--mv-bg) !important;
}
.mv-share-hint {
  font-size: .72rem;
  line-height: 1.4;
}
.mv-share-panel-close {
  position: absolute;
  top: .4rem;
  right: .4rem;
  background: none;
  border: none;
  color: var(--mv-text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: .85rem;
  line-height: 1;
}
.mv-share-panel-close:hover { color: var(--mv-text); }

/* ── Shared-view banner ──────────────────────────────────────────── */
.mv-shared-banner {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  background: var(--mv-primary-light);
  border-bottom: 1px solid var(--mv-border);
  font-size: .8rem;
  color: var(--mv-primary-dark);
  flex-shrink: 0;
}
.mv-shared-banner i { font-size: 1rem; }
.mv-shared-banner-link {
  font-weight: 600;
  color: var(--mv-primary);
}


/* ── Inline search panel (collapsible, sits in page flow) ──────── */

.mv-expr-search-panel {
  flex-shrink: 0;
  background: var(--mv-surface);
  border-bottom: 1px solid var(--mv-border);
  overflow: hidden;
  max-height: 0;
  transition: max-height .28s cubic-bezier(0.4, 0, 0.2, 1);
}

.mv-expr-search-panel.open {
  max-height: 960px;
}

.mv-expr-search-panel-inner {
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 620px;
}

.mv-expr-search-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mv-expr-search-panel-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--mv-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mv-expr-search-panel-title .bi { color: var(--mv-primary); }

.mv-expr-search-panel-close {
  margin-left: auto;
  background: none;
  border: none;
  padding: 3px 5px;
  color: var(--mv-text-muted);
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
  transition: background .12s, color .12s;
}

.mv-expr-search-panel-close:hover {
  background: var(--mv-bg);
  color: var(--mv-text);
}


/* ── Search modal ─────────────────────────────────────────────── */

.mv-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.mv-search-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.mv-search-drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -47%) scale(.96);
  width: min(560px, calc(100vw - 32px));
  max-height: 85vh;
  background: var(--mv-surface);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--mv-border);
  box-shadow: 0 24px 64px rgba(0,0,0,.16), 0 4px 16px rgba(0,0,0,.06);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.4,.64,1), opacity .18s ease;
}
.mv-search-drawer.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.mv-search-drawer-header {
  display: flex;
  align-items: center;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--mv-border);
  flex-shrink: 0;
}
.mv-search-drawer-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--mv-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mv-search-drawer-title .bi { color: var(--mv-primary); }
.mv-search-drawer-close {
  margin-left: auto;
  background: none;
  border: none;
  padding: 4px 6px;
  color: var(--mv-text-muted);
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
  transition: background .12s, color .12s;
}
.mv-search-drawer-close:hover {
  background: var(--mv-bg);
  color: var(--mv-text);
}

/* Scrollable body */
.mv-search-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Type indicator bar (inside textarea wrapper) */
.mv-input-type-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 6px;
  border-top: 1px solid var(--mv-border);
}
.mv-input-nl-hint {
  font-size: .72rem;
  color: var(--mv-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.mv-input-nl-hint strong { color: var(--mv-text); }

.mv-search-type-badge {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: .02em;
  border: 1px solid currentColor;
  /* default: gene names */
  color: var(--mv-primary);
  background: var(--mv-primary-light);
  transition: color .15s, background .15s;
}
.mv-search-type-dna-sequence {
  color: #0369a1;
  background: #e0f2fe;
}
.mv-search-type-fasta {
  color: #15803d;
  background: #dcfce7;
}
.mv-search-type-snp---rsid {
  color: #b45309;
  background: #fef3c7;
}

/* Textarea + drop zone */
.mv-search-input-wrap {
  position: relative;
  border-radius: 6px;
  border: 1px solid var(--mv-border);
  transition: border-color .15s;
  overflow: hidden;  /* keeps rounded corners for the type bar */
}
.mv-search-input-wrap:focus-within {
  border-color: var(--mv-primary);
  box-shadow: 0 0 0 2px rgba(109, 40, 217, .08);
}
.mv-search-input-wrap.dragover {
  border-color: var(--mv-primary);
  border-style: dashed;
  background: var(--mv-primary-light);
}
.mv-search-textarea {
  display: block;
  width: 100%;
  min-height: 130px;
  padding: 10px 12px;
  font-size: .8rem;
  line-height: 1.6;
  resize: vertical;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--mv-text);
  outline: none;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}
.mv-search-textarea::placeholder { color: var(--mv-text-lighter); }

/* Drag overlay */
.mv-search-drop-overlay {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: rgba(109, 40, 217, .06);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--mv-primary);
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
}
.mv-search-drop-overlay.active { opacity: 1; }
.mv-search-drop-overlay .bi { font-size: 1.3rem; }

/* FASTA stats */
.mv-fasta-stats {
  display: none;
  animation: fadeIn .18s ease;
}
.mv-fasta-stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mv-fasta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  padding: 3px 9px;
  border-radius: 10px;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.mv-fasta-pill-warn {
  background: #fff7ed;
  color: #b45309;
  border-color: #fed7aa;
  display: none;
}

/* File drop hint */
.mv-search-file-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  margin-top: 6px;
}
.mv-search-file-link {
  color: var(--mv-primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mv-search-file-link:hover { text-decoration: none; }

/* Examples */
.mv-search-examples { display: flex; flex-direction: column; gap: 6px; }
.mv-search-examples-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--mv-text-lighter);
}
.mv-search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.mv-search-chip {
  font-size: .75rem;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--mv-border);
  background: var(--mv-bg);
  color: var(--mv-text);
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
  font-family: inherit;
}
.mv-search-chip:hover {
  border-color: var(--mv-primary);
  background: var(--mv-primary-light);
  color: var(--mv-primary);
}

/* Section divider */
.mv-search-section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mv-text-lighter);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.mv-search-section-divider::before,
.mv-search-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--mv-border);
}

/* Options */
.mv-search-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mv-search-option-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mv-search-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mv-search-option-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--mv-text);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mv-search-option-hint {
  font-size: .67rem;
  font-weight: 400;
  color: var(--mv-text-lighter);
}
.mv-search-num-input {
  border: 1px solid var(--mv-border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: .8rem;
  width: 100%;
  color: var(--mv-text);
  background: var(--mv-surface);
  outline: none;
  transition: border-color .12s;
}
.mv-search-num-input:focus {
  border-color: var(--mv-primary);
}
.mv-search-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.mv-search-toggle-cb {
  accent-color: var(--mv-primary);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.mv-search-toggle-label {
  font-size: .8rem;
  color: var(--mv-text);
}

/* Limits note */
.mv-search-limits-note {
  font-size: .72rem;
  color: var(--mv-text-muted);
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
  border-top: 1px solid var(--mv-border);
  padding-top: 12px;
  margin-top: 2px;
}
.mv-search-limits-note .bi { flex-shrink: 0; }
.mv-search-limits-note a { color: var(--mv-text-muted); }
.mv-search-limits-note a:hover { color: var(--mv-primary); }

/* Footer */
.mv-search-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--mv-border);
  flex-shrink: 0;
  background: var(--mv-bg);
}
.mv-search-signin-link {
  font-size: .8rem;
  color: var(--mv-text-muted);
  text-decoration: none;
}
.mv-search-signin-link:hover { color: var(--mv-primary); }

/* ── Search mode segmented control ─────────────────────────────────────── */
.mv-search-seg {
  display: flex;
  position: relative;
  background: var(--mv-bg);
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
/* Sliding pill indicator — moves between the two buttons */
.mv-search-seg-indicator {
  position: absolute;
  top: 3px; bottom: 3px;
  left: 3px;
  width: calc(50% - 4.5px);
  border-radius: 5px;
  background: var(--mv-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.10), 0 0 0 1px var(--mv-border);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 0;
}
.mv-search-seg.mode-ai .mv-search-seg-indicator {
  transform: translateX(calc(100% + 3px));
}
.mv-search-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: .8rem;
  font-weight: 500;
  border: none;
  border-radius: 5px;
  color: var(--mv-text-muted);
  background: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color .2s;
  white-space: nowrap;
}
.mv-search-seg-btn.active {
  color: var(--mv-text);
}
.mv-search-seg-btn:not(.active):hover {
  color: var(--mv-text);
}

/* ── Panel slide-in animations ──────────────────────────────────────────── */
@keyframes mv-slide-from-right {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes mv-slide-from-left {
  from { opacity: 0; transform: translateX(-22px); }
  to   { opacity: 1; transform: translateX(0); }
}
.mv-panel-enter-from-right {
  animation: mv-slide-from-right 0.27s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.mv-panel-enter-from-left {
  animation: mv-slide-from-left 0.27s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── AI interpret panel ─────────────────────────────────────────────────── */
.mv-ai-panel { display: flex; flex-direction: column; gap: 8px; }

.mv-ai-prompt-input {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  background: var(--mv-bg);
  color: var(--mv-text);
  font-size: .85rem;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
.mv-ai-prompt-input:focus {
  outline: none;
  border-color: var(--mv-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mv-primary) 15%, transparent);
}

.mv-ai-btn {
  width: 100%;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--mv-primary);
  color: #fff;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity .15s;
}
.mv-ai-btn:disabled { opacity: .55; cursor: not-allowed; }
.mv-ai-btn:not(:disabled):hover { opacity: .88; }

/* Feedback area (status text + optional progress bar) */
.mv-ai-feedback {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mv-ai-pbar {
  height: 3px;
  background: var(--mv-border);
  border-radius: 2px;
  overflow: hidden;
}
.mv-ai-pbar-fill {
  height: 100%;
  background: var(--mv-primary);
  border-radius: 2px;
  transition: width .35s ease;
}

.mv-ai-status {
  font-size: .78rem;
  color: var(--mv-text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.mv-ai-status.mv-ai-error { color: var(--mv-danger, #dc3545); }

.mv-ai-result-preview {
  background: var(--mv-bg);
  border: 1px solid var(--mv-border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: .8rem;
  color: var(--mv-text-muted);
  word-break: break-word;
  display: none;
}
.mv-ai-result-preview.visible { display: block; }
.mv-ai-result-preview .bi-check2 { font-size: .85rem; }

/* AI textarea wrapper with char counter */
.mv-ai-textarea-wrap { position: relative; }
.mv-ai-char-row {
  display: flex;
  justify-content: flex-end;
  padding: 3px 8px 4px;
  border-top: 1px solid var(--mv-border);
  background: var(--mv-bg);
  border-radius: 0 0 6px 6px;
}
.mv-ai-textarea-wrap .mv-ai-prompt-input {
  border-radius: 6px 6px 0 0;
  border-bottom: none;
}
.mv-ai-char-count {
  font-size: .72rem;
  color: var(--mv-text-lighter);
  font-variant-numeric: tabular-nums;
  transition: color .15s;
}
.mv-ai-char-count.mv-ai-char-warn { color: #b45309; }
.mv-ai-char-count.mv-ai-char-limit { color: var(--mv-danger, #dc3545); font-weight: 600; }
.mv-ai-char-max { font-size: .72rem; color: var(--mv-text-lighter); }

/* LLM disclaimer */
.mv-ai-disclaimer {
  margin: 0;
  font-size: .72rem;
  color: var(--mv-text-lighter);
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.4;
}
.mv-ai-disclaimer .bi { flex-shrink: 0; margin-top: 1px; }

/* ── Advanced params toggle ─────────────────────────────────────────────── */
.mv-advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: var(--mv-text-muted);
  cursor: pointer;
  border: none;
  background: none;
  padding: 2px 0;
  transition: color .15s;
}
.mv-advanced-toggle:hover { color: var(--mv-text); }

.mv-advanced-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mv-primary);
  display: none;
  flex-shrink: 0;
}
.mv-advanced-dot.visible { display: inline-block; }

.mv-advanced-section {
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s ease;
}
.mv-advanced-section.open { max-height: 300px; }

/* ── Example chips ──────────────────────────────────────────────────────── */
.mv-example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.mv-example-chip {
  padding: 3px 9px;
  border: 1px solid var(--mv-border);
  border-radius: 12px;
  font-size: .75rem;
  color: var(--mv-text-muted);
  cursor: pointer;
  background: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.mv-example-chip:hover {
  background: var(--mv-bg);
  border-color: var(--mv-primary);
  color: var(--mv-primary);
}

/* ── Page drag-drop overlay ─────────────────────────────────────────────── */
.mv-page-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(109, 40, 217, 0.06);
  border: 3px dashed var(--mv-primary);
  border-radius: 12px;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.mv-page-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: 16px;
  padding: 32px 48px;
  box-shadow: 0 8px 32px rgba(109,40,217,.15);
}
.mv-page-drop-icon {
  font-size: 3rem;
  color: var(--mv-primary);
}
.mv-page-drop-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--mv-primary);
}

/* ── Coverage artifact chip ─────────────────────────────────────────────── */
.mv-cov-artifact-chip {
  margin: 8px;
  padding: 10px 12px;
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  background: var(--mv-surface);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.mv-cov-artifact-chip:hover {
  border-color: var(--mv-primary);
  background: var(--mv-primary-light);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* ── Ontology browser ──────────────────────────────────────────── */
.mv-ontology-filter {
  width: 520px !important;
}

/* Level selector row */
.mv-onto-level-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--mv-border);
}
.mv-onto-level-label {
  font-size: .72rem;
  color: var(--mv-text-muted);
  white-space: nowrap;
}
.mv-onto-level-btns {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.mv-onto-lvl-btn {
  font-size: .7rem;
  padding: 1px 7px;
  border: 1px solid var(--mv-border);
  border-radius: 10px;
  background: var(--mv-bg);
  color: var(--mv-text-muted);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  line-height: 1.5;
}
.mv-onto-lvl-btn:hover {
  background: var(--mv-primary-light);
  border-color: var(--mv-primary);
  color: var(--mv-primary);
}
.mv-onto-lvl-btn.active {
  background: var(--mv-primary);
  border-color: var(--mv-primary);
  color: white;
}

/* Action row (above finder) */
.mv-onto-act-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  margin-bottom: 4px;
}
.mv-onto-summary {
  margin-left: auto;
}

/* Finder columns wrapper */
.mv-onto-cols-wrapper {
  display: flex;
  overflow-x: auto;
  border: 1px solid var(--mv-border);
  border-radius: var(--mv-radius);
  background: var(--mv-surface);
  max-height: 240px;
  gap: 0;
}

/* Individual finder column */
.mv-onto-col {
  min-width: 180px;
  max-width: 220px;
  border-right: 1px solid var(--mv-border);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 2px 0;
}
.mv-onto-col:last-child { border-right: none; }

/* Finder item */
.mv-onto-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: .8rem;
  color: var(--mv-text);
  border-radius: 3px;
  margin: 1px 2px;
  transition: background .1s;
}
.mv-onto-item:hover { background: var(--mv-bg); }
.mv-onto-item.selected { background: var(--mv-primary-light); color: var(--mv-primary); }
.mv-onto-item.expanded { background: var(--mv-primary); color: white; }
.mv-onto-item.expanded .mv-onto-arrow { color: white; }

.mv-onto-cb {
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--mv-primary);
}
.mv-onto-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
  min-width: 0;
}
.mv-onto-item-count {
  flex-shrink: 0;
  font-size: .6rem;
  color: var(--mv-text-muted);
  background: var(--mv-bg);
  border: 1px solid var(--mv-border);
  border-radius: 8px;
  padding: 0 4px;
  line-height: 1.5;
}
.mv-onto-item.selected .mv-onto-item-count {
  background: rgba(109,40,217,.08);
  border-color: var(--mv-primary-light);
  color: var(--mv-primary);
}
.mv-onto-item.expanded .mv-onto-item-count {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.3);
  color: white;
}
.mv-onto-arrow {
  color: var(--mv-text-muted);
  font-size: .9rem;
  flex-shrink: 0;
  line-height: 1;
}

/* Filter button with ontology browser available */
.mv-onto-filter-btn {
  color: var(--mv-primary) !important;
  padding: 1px 3px !important;
  border-radius: 3px !important;
}
.mv-onto-filter-btn:hover {
  background: var(--mv-primary-light) !important;
  color: var(--mv-primary) !important;
}
.mv-onto-filter-btn.active {
  background: var(--mv-primary) !important;
  color: white !important;
}

/* Ontology level badge in column header */
.mv-onto-level-badge {
  font-size: .6rem;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--mv-primary-light);
  color: var(--mv-primary);
  border: 1px solid var(--mv-primary);
  white-space: nowrap;
  cursor: default;
  flex-shrink: 0;
}

/* Filter title inside ontology dropdown */
.mv-onto-filter-title {
  font-size: .8rem;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--mv-border);
  margin-bottom: 6px;
}
