/* Explorer chrome aligned with the Console design language.
 *
 * Scoped to the Expression and Coverage roots. This only changes the shell,
 * toolbars, filters, legends and table headings; the data tables and their JS
 * keep their existing dimensions and behaviour. */

#expressionExplorer,
#coverageExplorer {
  background: var(--mv-surface) !important;
  color: var(--mv-text) !important;
}

/* One Explorer shell for every data/workspace page. */
.mv-app-context-sidebar {
  background: var(--mv-surface) !important;
  border-right: 1px solid var(--mv-border) !important;
  box-shadow: none !important;
}

.mv-app-sidebar-brand {
  min-height: 40px !important;
  padding: 0 12px 0 14px !important;
  border-bottom: 1px solid var(--mv-border) !important;
  background: var(--mv-canvas) !important;
}

.mv-app-sidebar-brand .mv-brand {
  gap: 7px !important;
  line-height: 1;
}

.mv-app-sidebar-brand .mv-brand-icon-shell .mv-brand-logo {
  width: 20px !important;
  height: 20px !important;
}

.mv-app-sidebar-brand .mv-brand-name {
  background: none !important;
  color: var(--mv-text) !important;
  -webkit-text-fill-color: var(--mv-text) !important;
  font-family: var(--mv-font-ui) !important;
  font-size: 0.875rem !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
}

.mv-app-sidebar-brand .mv-brand-sep {
  margin: 0 1px;
  color: var(--mv-text-lighter) !important;
  font-size: 0.875rem;
  font-weight: 400;
}

.mv-app-sidebar-brand .mv-brand-sub {
  color: var(--mv-text-muted) !important;
  font-size: 0.875rem;
  font-weight: 500;
}

.mv-sidebar-subtitle {
  padding: 9px 16px 10px !important;
  color: var(--mv-text-lighter) !important;
  font-size: 0.6875rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
}

.mv-app-sidebar-nav {
  gap: 1px !important;
  padding: 0 10px 8px !important;
}

.mv-app-sidebar-link {
  min-height: 30px !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--mv-text-muted) !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

.mv-app-sidebar-link i {
  width: 15px !important;
  color: var(--mv-text-lighter) !important;
  font-size: 0.8rem !important;
}

.mv-app-sidebar-link:hover {
  background: var(--mv-surface-3) !important;
  color: var(--mv-text) !important;
}

.mv-app-sidebar-link.active {
  background: var(--mv-surface-3) !important;
  color: var(--mv-text) !important;
  font-weight: 600 !important;
  box-shadow: none;
}

.mv-app-sidebar-link.active i {
  color: var(--mv-text) !important;
}

.mv-app-sidebar-bottom {
  background: var(--mv-surface) !important;
  border-top: 1px solid var(--mv-border) !important;
}

.mv-sidebar-dock-btn {
  color: var(--mv-text-muted) !important;
}

.mv-page-context-bar {
  min-height: 40px !important;
  padding: 0 16px !important;
  gap: 12px !important;
  background: var(--mv-canvas) !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
}

.mv-page-context-bar::after {
  display: none !important;
}

.mv-page-context-title {
  gap: 8px !important;
  color: var(--mv-text) !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
}

.mv-page-context-title i {
  display: inline-flex !important;
  color: var(--mv-text-muted) !important;
  font-size: 0.8rem !important;
}

.mv-page-context-actions {
  gap: 4px !important;
}

.mv-page-context-action {
  height: 28px !important;
  padding: 0 8px !important;
  gap: 5px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--mv-text-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
}

.mv-page-context-action i {
  color: var(--mv-text-lighter) !important;
  font-size: 0.78rem !important;
}

.mv-page-context-action:hover {
  background: var(--mv-surface-soft) !important;
  color: var(--mv-text) !important;
}

#expressionExplorer .mv-table-toolbar,
#coverageExplorer .mv-table-toolbar {
  min-height: 44px !important;
  padding: 0 12px 0 16px !important;
  gap: 4px !important;
  background: var(--mv-surface) !important;
  border-bottom: 1px solid var(--mv-border) !important;
  box-shadow: none !important;
}

#expressionExplorer .mv-table-toolbar .btn,
#expressionExplorer .mv-table-toolbar .btn-sm,
#expressionExplorer .mv-table-toolbar .btn-outline-secondary,
#coverageExplorer .mv-table-toolbar .btn,
#coverageExplorer .mv-table-toolbar .btn-sm,
#coverageExplorer .mv-table-toolbar .btn-outline-secondary {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 8px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: var(--mv-text-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
}

#expressionExplorer .mv-table-toolbar .btn i,
#coverageExplorer .mv-table-toolbar .btn i {
  color: var(--mv-text-lighter) !important;
  font-size: 0.78rem !important;
}

#expressionExplorer .mv-table-toolbar .btn:hover,
#expressionExplorer .mv-table-toolbar .btn[aria-expanded="true"],
#coverageExplorer .mv-table-toolbar .btn:hover,
#coverageExplorer .mv-table-toolbar .btn[aria-expanded="true"] {
  background: var(--mv-surface-soft) !important;
  color: var(--mv-text) !important;
}

#expressionExplorer .mv-table-toolbar .mv-btn-primary,
#coverageExplorer .mv-table-toolbar .mv-btn-primary {
  background: var(--mv-text) !important;
  color: var(--mv-surface) !important;
}

/* One icon-only action treatment for both explorers. */
#expressionExplorer .mv-toolbar-icon-btn,
#coverageExplorer .mv-toolbar-icon-btn {
  width: 28px !important;
  padding: 0 !important;
  justify-content: center !important;
}

/* Four-way view selector: table / compact table / list / compact list. */
.mv-view-modes {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 2px;
  gap: 1px;
  flex-shrink: 0;
  border: 1px solid var(--mv-border);
  border-radius: 6px;
  background: var(--mv-surface);
}

.mv-view-mode {
  width: 26px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--mv-text-muted);
}

.mv-view-mode i {
  font-size: 0.8rem;
  color: inherit;
}

.mv-view-mode:hover {
  background: var(--mv-surface-soft);
  color: var(--mv-text);
}

.mv-view-mode.active {
  background: var(--mv-surface-3);
  color: var(--mv-text);
}

.mv-view-mode:focus-visible {
  outline: 2px solid var(--mv-text-muted);
  outline-offset: 1px;
}

.mv-view-mode-sep {
  width: 1px;
  height: 14px;
  margin: 0 2px;
  background: var(--mv-border);
}

.mv-display-menu input[type="range"] {
  accent-color: var(--mv-primary);
}

#expressionExplorer .mv-fs-strip,
#coverageExplorer .mv-fs-strip {
  padding: 8px 16px !important;
  gap: 8px !important;
  background: var(--mv-surface) !important;
  border-bottom: 1px solid var(--mv-border) !important;
}

#expressionExplorer .mv-fs-root,
#coverageExplorer .mv-fs-root {
  max-width: none !important;
}

#expressionExplorer .mv-fs-token-wrap,
#coverageExplorer .mv-fs-token-wrap {
  min-height: 30px !important;
  padding: 0 4px 0 8px !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

#expressionExplorer .mv-fs-input,
#coverageExplorer .mv-fs-input {
  font-size: 0.75rem !important;
}

#expressionExplorer .mv-fs-btn,
#expressionExplorer .mv-fs-mincells,
#coverageExplorer .mv-fs-btn,
#coverageExplorer .mv-fs-mincells {
  height: 28px !important;
  padding: 0 8px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  font-size: 0.75rem !important;
}

#expressionExplorer .mv-fs-btn:hover,
#expressionExplorer .mv-fs-mincells:hover,
#expressionExplorer .mv-fs-save-btn:hover,
#coverageExplorer .mv-fs-btn:hover,
#coverageExplorer .mv-fs-mincells:hover,
#coverageExplorer .mv-fs-save-btn:hover {
  background: var(--mv-surface-soft) !important;
  border: 0 !important;
  color: var(--mv-text) !important;
}

#expressionExplorer .mv-fs-save-btn,
#coverageExplorer .mv-fs-save-btn {
  width: 28px !important;
  height: 28px !important;
  border: 0 !important;
}

#expressionExplorer .mv-results-info-strip,
#coverageExplorer .mv-stats-bar,
#coverageExplorer .mv-legend-bar {
  min-height: 34px !important;
  padding: 6px 16px !important;
  gap: 12px !important;
  background: var(--mv-surface) !important;
  border-bottom: 1px solid var(--mv-border) !important;
  color: var(--mv-text-muted) !important;
}

#coverageExplorer .mv-stat-chip {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--mv-text-muted) !important;
  font-size: 0.75rem !important;
}

#coverageExplorer .mv-stat-chip b {
  color: var(--mv-text) !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
}

#expressionExplorer .mv-expr-table thead th,
#coverageExplorer .mv-expr-table thead th {
  padding: 8px 10px !important;
  background: var(--mv-surface-soft) !important;
  border-bottom: 1px solid var(--mv-border) !important;
  color: var(--mv-text-muted) !important;
  font-size: 0.6875rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#expressionExplorer .mv-expr-table tbody td,
#coverageExplorer .mv-expr-table tbody td {
  border-bottom-color: var(--mv-border) !important;
}

#expressionExplorer .mv-expr-table tbody tr:hover,
#coverageExplorer .mv-expr-table tbody tr:hover {
  background: var(--mv-surface-soft) !important;
}

#expressionExplorer .mv-empty-icon-wrap,
#coverageExplorer .mv-empty-icon-wrap,
#analysisExplorer .mv-empty-icon-wrap {
  width: 44px !important;
  height: 44px !important;
  border-radius: 8px !important;
  background: var(--mv-surface-soft) !important;
  color: var(--mv-chart-1) !important;
  font-size: 1.1rem !important;
}

#analysisExplorer .mv-empty-icon-wrap {
  color: var(--mv-text-muted) !important;
}

#expressionExplorer .mv-empty-display,
#coverageExplorer .mv-empty-display,
#analysisExplorer .mv-empty-display {
  font-family: var(--mv-font-ui) !important;
  font-size: 0.9375rem !important;
  font-style: normal !important;
  font-weight: 600 !important;
}

@media (max-width: 991.98px) {
  #expressionExplorer .mv-page-context-bar,
  #coverageExplorer .mv-page-context-bar {
    padding: 0 12px !important;
  }

  #expressionExplorer .mv-table-toolbar,
  #coverageExplorer .mv-table-toolbar {
    padding: 0 10px !important;
  }

  #expressionExplorer .mv-fs-strip,
  #coverageExplorer .mv-fs-strip {
    padding: 6px 10px !important;
  }

  #expressionExplorer .mv-results-info-strip,
  #coverageExplorer .mv-stats-bar,
  #coverageExplorer .mv-legend-bar {
    padding: 6px 10px !important;
  }
}

/* The artifact list is part of the rail, not a second white panel. */
.mv-app-context-sidebar .mv-artifact-list {
  background: transparent !important;
  border-color: var(--mv-border) !important;
}

.mv-sidebar-search-footer {
  background: var(--mv-surface) !important;
}

/* Explorer top bar actions: page actions left, user/preferences right. */
.mv-page-context-actions {
  width: 100%;
  margin-left: 0 !important;
}

@media (max-width: 767.98px) {
  .mv-page-context-action span {
    display: none;
  }
}


/* Keep the sidebar's own collapse affordance; its brand lives in the app header. */
.mv-app-context-sidebar {
  position: relative;
}

.mv-app-sidebar-brand {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  display: flex !important;
  min-height: 0 !important;
  padding: 0 !important;
  justify-content: center;
  border: 0 !important;
  background: transparent !important;
}

.mv-app-sidebar-brand .mv-brand {
  display: none !important;
}

/* Header spans both columns; the layout below owns the viewport remainder. */
.mv-page-context-bar {
  position: fixed !important;
  top: 0;
  right: 0;
  left: 0;
  z-index: 2000;
  height: 40px !important;
  min-height: 40px !important;
  overflow: visible !important;
  background: var(--mv-canvas) !important;
  border-bottom: 0 !important;
  box-shadow: none;
}

.mv-page-context-bar .dropdown-menu {
  z-index: 3000 !important;
}

html[data-theme] body .mv-single-sidebar-shell {
  height: calc(100vh - 52px) !important;
  margin: 44px 8px 8px !important;
  overflow: hidden !important;
  background: var(--mv-surface) !important;
  border-radius: 6px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 0 0 0.5px rgba(0, 0, 0, 0.12);
}

@media (max-width: 991.98px) {
  html[data-theme] body .mv-single-sidebar-shell {
    height: calc(100vh - 48px) !important;
    margin: 44px 4px 4px !important;
  }
}

/* Fixed headers must not inherit the table fade transform's containing block. */
#tableArea,
#coverageMainArea,
#analysisWorkspace {
  animation: none !important;
}

@media (max-width: 991.98px) {
  .mv-page-context-actions {
    width: auto;
    flex: 1;
  }
}

@media (max-width: 767.98px) {
  .mv-page-context-action span {
    display: none;
  }
}

/* Theme.css is loaded after this page sheet; use matching specificity for the
 * app header surface so it stays distinct from white content. */
html[data-theme] body .mv-page-context-bar {
  background: var(--mv-canvas) !important;
  border-bottom: 0 !important;
  box-shadow: none;
}

html[data-theme] body .mv-page-context-bar .dropdown-menu {
  z-index: 3000 !important;
}

.mv-sidebar-collapsed .mv-app-sidebar-nav {
  padding-top: 40px !important;
}

/* Static workspace pages have no search-results rail. */
.mv-static-app-shell .mv-app-context-sidebar {
  display: none !important;
}


.mv-expr-more-menu {
  min-width: 232px;
}

/* Browse mode has no table legend; the JS hides these strips inline, but a
 * legacy force-display rule in explorer.css overrides inline styles. */
#expressionExplorer #exprResultsStrip[style*="display: none"],
#coverageExplorer #covLegendBar[style*="display: none"] {
  display: none !important;
}

/* Table-only controls are hidden while browsing, including elements whose
 * Bootstrap display utility uses !important. */
#expressionExplorer .mv-table-only-hidden,
#coverageExplorer .mv-table-only-hidden {
  display: none !important;
}


/* Dense coverage rows to match the compact-table view mode. */
#coverageExplorer .mv-compact-mode .mv-expr-table thead th {
  padding: 5px 8px !important;
}

#coverageExplorer .mv-compact-mode .mv-expr-table tbody td:not([colspan]) {
  height: 26px !important;
  padding: 2px 8px !important;
  line-height: 1.15 !important;
}

#coverageExplorer .mv-compact-mode .mv-whisker-cell {
  height: 16px !important;
}

#coverageExplorer .mv-compact-mode .mv-whisker-cell svg {
  height: 20px !important;
}

/* The sidebar collapse control floats at the right of the search header; reserve
 * its footprint so the + new-search button remains visible and clickable. */
.mv-sidebar-workspace-title {
  padding-right: 44px !important;
}

/* Keep the search and collapse controls on one visual baseline and make them
 * the same target size. */
#expressionExplorer .mv-sidebar-workspace-title #btnAddSearch,
#coverageExplorer .mv-sidebar-workspace-title #btnNewCovSearch {
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  margin-right: 0 !important;
}

#expressionExplorer .mv-app-sidebar-brand,
#coverageExplorer .mv-app-sidebar-brand {
  top: 16px !important;
}

/* Keep the Apps menu pinned to its trigger. Popper can otherwise shift it into
 * the content column when the header sits inside the application shell; the
 * menu should overlay the sidebar and be independent of its bounds. */
.mv-page-context-bar .mv-app-selector-menu.show {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  left: 0 !important;
  right: auto !important;
  margin-top: 0 !important;
  transform: none !important;
}
