/* RC50 analysis drawer: sibling to the primary workspace, never underneath rails. */
.sim-wb-analysis-drawer {
  position: relative;
  z-index: 5;
  min-width: 0;
  color: var(--sim-text);
  background: #0a1821;
  border-top: 1px solid var(--sim-line-strong);
  overflow: hidden;
}
.sim-wb-analysis-header {
  min-height: 3.6rem;
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) auto;
  align-items: stretch;
  background: #0b1c25;
}
.sim-wb-analysis-toggle {
  min-width: 0;
  min-height: 3.6rem;
  padding: .52rem .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  color: var(--sim-text);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--sim-line);
}
.sim-wb-analysis-toggle > span:first-child { min-width: 0; display: grid; gap: .12rem; }
.sim-wb-analysis-toggle .eyebrow { margin: 0; font-size: .68rem; }
.sim-wb-analysis-toggle strong { font-size: .95rem; }
.sim-wb-analysis-toggle [data-analysis-state] { color: var(--sim-cyan); font-size: .72rem; }
.sim-wb-analysis-context {
  min-width: 28rem;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(6rem, 1fr));
  background: var(--sim-line);
  gap: 1px;
}
.sim-wb-analysis-context div { min-width: 0; padding: .5rem .6rem; background: #091820; }
.sim-wb-analysis-context dt { color: var(--sim-muted); font: 800 .65rem/1.2 var(--font-mono, var(--mono, ui-monospace, monospace)); text-transform: uppercase; }
.sim-wb-analysis-context dd { margin: .2rem 0 0; color: var(--sim-text); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-wb-analysis-content {
  height: min(38dvh, 31rem);
  min-height: 17rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  color: var(--sim-text);
  background: #0b1821;
}
.sim-wb-representations {
  min-width: 0;
  min-height: 100%;
  color: var(--sim-text);
  background: #0b1821;
}
.sim-wb-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  background: #0d202a;
  border-bottom: 1px solid var(--sim-line-strong);
  scrollbar-gutter: stable;
}
.sim-wb-tabs button {
  flex: 0 0 auto;
  min-height: 2.85rem;
  padding: .65rem .85rem;
  color: var(--sim-text);
  background: var(--sim-control-bg);
  border: 0;
  border-right: 1px solid var(--sim-line);
  font: 800 .73rem/1.2 var(--font-mono, var(--mono, ui-monospace, monospace));
}
.sim-wb-tabs button[aria-selected="true"] {
  color: #041018;
  background: var(--sim-cyan);
  box-shadow: inset 0 -3px 0 #ffffff;
}
.sim-wb-tabpanel {
  min-width: 0;
  padding: 1rem;
  color: var(--sim-text);
  background: #0b1821;
}
.sim-wb-tabpanel :where(p, td, dd, li, figcaption, span) { color: var(--sim-body); }
.sim-wb-tabpanel :where(h3, h4, th, strong) { color: var(--sim-text); }
.sim-wb-tabpanel :where(table, th, td) { border-color: var(--sim-line); }
.sim-wb-table-wrap { border-color: var(--sim-line); background: #0c1d26; }
.sim-wb-table-wrap table { color: var(--sim-text); background: #0c1d26; }
.sim-wb-table-wrap thead { background: #102630; }
.sim-wb-table-wrap tbody tr:nth-child(even) { background: #0f222b; }
.sim-wb-table-wrap button { min-height: 2.75rem; color: var(--sim-cyan); background: transparent; border: 1px solid transparent; }
.sim-wb-compare-column,
.sim-wb-narrative,
.sim-wb-autonomy-grid section,
.sim-wb-chart-shell,
.sim-wb-branch-visual {
  color: var(--sim-text);
  background: #0d202a;
  border-color: var(--sim-line);
}
.sim-wb-chart-controls { color: var(--sim-body); }
.sim-wb-chart-controls select { width: auto !important; min-width: 12rem; min-height: 2.75rem; }
.sim-wb-divergence-controls button,
.sim-wb-branch-compare-controls button,
.sim-wb-branch-compare-controls select { min-height: 2.75rem; }
.sim-wb-raw { color: #dff9fa; background: #041018; border-color: var(--sim-line); }

/* RC50 P0 fit contract: opening analysis preserves a usable center-scene
   preview instead of consuming the entire primary workspace. */
.sim-wb-analysis-content {
  height: min(30dvh, 24rem);
  min-height: 13rem;
}
.sim-wb-tabs button,
.sim-wb-tabpanel {
  scroll-margin-top: 5rem;
}
