/* EMC execution monitor ownership. Loaded last by the canonical resource manager. */
.marss-emc .marss-emc-monitor{overflow:hidden;margin:0 0 10px;border:1px solid #263b5d;border-radius:11px;background:var(--emc-monitor);color:var(--emc-monitor-text)}
.marss-emc .marss-emc-monitor-summary{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:9px;padding:8px 10px}
.marss-emc .marss-emc-monitor-signal{width:11px;height:11px;border:3px solid #74cbb1;border-radius:50%}
.marss-emc .marss-emc-monitor-signal.is-busy{animation:marss-emc-pulse 1s infinite}
@keyframes marss-emc-pulse{50%{box-shadow:0 0 0 6px rgba(116,203,177,.14)}}
.marss-emc .marss-emc-monitor-copy{min-width:0}
.marss-emc .marss-emc-monitor-copy strong,.marss-emc .marss-emc-monitor-copy small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.marss-emc .marss-emc-monitor-copy small,.marss-emc .marss-emc-monitor-elapsed{color:#93a8c4;font-size:.7rem}
.marss-emc .marss-emc-monitor-elapsed{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-variant-numeric:tabular-nums}
.marss-emc .marss-emc-monitor-toggle{padding:4px 8px;border:1px solid #415474;border-radius:6px;background:transparent;color:var(--emc-monitor-text);cursor:pointer;font:inherit}
.marss-emc .marss-emc-monitor-progress{height:4px;background:#263650}
.marss-emc .marss-emc-monitor-progress>span{display:block;width:0;height:100%;background:#74cbb1;transition:width .2s ease}
.marss-emc .marss-emc-monitor-details{padding:0 10px 10px}
.marss-emc .marss-emc-monitor-details[hidden]{display:none!important}
.marss-emc .marss-emc-monitor-meta{display:flex;justify-content:space-between;margin:6px 0;color:#aebdd2;font-size:.68rem}
.marss-emc .marss-emc-activity-log{max-height:100px;overflow:auto;margin:0;padding:7px 9px 7px 27px;border:1px solid #263b5d;border-radius:7px;background:#07111e;color:#c7d5e8;font:11px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace}
.marss-emc .marss-emc-activity-log>li[data-status="success"]{color:#8ed5bf}
.marss-emc .marss-emc-activity-log>li[data-status="error"]{color:#f08ca2}

/* =========================================================================
   MARSS SHELL STANDARD - ported from Normalization & QC (the canonical MARSS
   module shell). Presentation/layout only. Every rule is scoped to EMC as the
   ACTIVE dock tool; File Reader / Row Namer / NQC / GB-Tox are untouched, and
   the shared dock markup (nav/partials/gb-marss-dock.php) is not edited.

   Mirrors normalization_qc.css: one coherent header, the shared chrome strip
   collapsed, the header lifted out of the scroll region, scroll ownership moved
   to an inner .emc-scroll wrapper (added in expression_matrix_canonicalization.php),
   and the disappearing scrollbar. All EMC hooks / IDs / stages / telemetry /
   version / status hooks are preserved - .emc-scroll is transparent to the
   descendant selectors the EMC JS uses.
========================================================================= */

/* 1) Collapse the redundant shared "MARSS MODULE / Expression Matrix
   Canonicalization / x" strip - take it out of flow so it reserves no space; its
   close control is re-homed into the EMC header by
   expression_matrix_canonicalization.init.js (bindEmcMinimizeControl). */
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .gb-marss-tool-slide__header {
  position: absolute;
  inset: 0 0 auto auto;
  padding: 0;
  border-bottom: none;
  background: none;
  pointer-events: none;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .gb-marss-tool-slide__header > div {
  display: none;
}

/* 2) Flex + min-height:0 chain - carries the dock's authoritative available
   height (.gb-marss-tool-slide { max-height: calc(100dvh - 130px) }, no hardcode)
   down to .emc-scroll so it can actually overflow instead of expand. */
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .gb-marss-tool-slide__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .gb-marss-tool-view[data-gb-marss-tool-view="expression_matrix_canonicalization"],
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .module-emc,
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
/* file_reader_main.css forces `.gb-marss-tool-slide .zom-widget { display: block
   !important }` on EVERY widget in the slide, EMC's included - which severs the
   height chain at the widget level. `display` is the only property that needs
   !important here. */
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .zom-widget--genebean-emc {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* 3) Header - flex:none sibling ABOVE .emc-scroll, genuinely outside the scroll
   track. Fixed at the top of the EMC card, subtle bottom border + restrained
   downward shadow, z-index above the scrolled content. .marss-emc-shell keeps
   its own 14px card padding, so the header just needs a bottom gap before the
   divider. */
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-header {
  flex: 0 0 auto;
  position: relative;
  z-index: 30;
  margin: 0;
  padding: 0 0 11px;
  border-bottom: 1px solid var(--emc-line-soft);
  box-shadow: 0 4px 10px -6px rgba(24, 43, 82, 0.22);
}
/* keep the (dynamic) status pill clear of the corner - control */
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-header .marss-emc-overall-status {
  margin-top: 40px;
}

/* 4) .emc-scroll - the scroll owner. Starts immediately below the header, ends at
   the bottom of the card; never runs beside the header or across the rounded top
   corners because the header sits above it, not inside it. Scrollbar muted at
   rest, revealed on hover / focus-within (CSS) or for ~800ms after a scroll (the
   .is-scrolling class toggled in expression_matrix_canonicalization.init.js).
   Gutter always reserved -> no reflow on reveal. Matches the NQC / file_reader /
   row_namer console-scrollbar pattern. */
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 10px 0 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll:hover,
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll:focus-within,
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll.is-scrolling {
  scrollbar-color: rgba(91, 112, 179, 0.42) transparent;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll::-webkit-scrollbar-track {
  background: transparent;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
  background-color: transparent;
  transition: background-color 0.2s ease;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll:hover::-webkit-scrollbar-thumb,
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll:focus-within::-webkit-scrollbar-thumb,
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll.is-scrolling::-webkit-scrollbar-thumb {
  background-color: rgba(91, 112, 179, 0.4);
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .emc-scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(91, 112, 179, 0.6);
}

/* 5) The re-homed close control as a minimal "-" window control (JS sets the
   actual text). Flat, no box, hover changes only the glyph colour. Same button
   element, [data-gb-marss-tool-slide-close] hook, handler and aria-label. */
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-header > .gb-marss-tool-slide__close {
  position: absolute;
  top: 10px;
  right: 2px;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--emc-muted);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: color 120ms ease;
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-header > .gb-marss-tool-slide__close:hover {
  background: none;
  color: var(--emc-text);
}
[data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-header > .gb-marss-tool-slide__close:focus-visible {
  outline: 2px solid rgba(var(--emc-accent), 0.55);
  outline-offset: 2px;
}

/* 6) Mobile - matches EMC's existing responsive breakpoint (emc_responsive.css
   @media 560px, where .marss-emc-header goes column). The dynamic status pill
   collapses to its bare dot, taken out of flow so it can never squeeze the
   "Expression Matrix Canonicalization" title; the live label is surfaced through
   the EMC tooltip overlay via data-tooltip (kept in sync in the init JS). */
@media (max-width: 560px) {
  [data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-header .marss-emc-overall-status {
    position: absolute;
    top: 15px;
    right: 26px;
    z-index: 1;
    margin: 0;
    padding: 0;
    gap: 0;
    border: 0;
    background: none;
    font-size: 0;
    line-height: 0;
  }
  [data-gb-marss-dock-wrapper][data-active-tool="expression_matrix_canonicalization"] .marss-emc-header .marss-emc-overall-status .marss-emc-status-dot {
    width: 10px;
    height: 10px;
  }
}
