/* Volume-story overlay — top bar + collapsible legend.
   Visual idiom mirrors search-panel.css (NVIDIA green accent, neutral grays,
   12px rounded panels, soft shadows, 13px system font stack). */

#volume-bar {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  color: #f9fafb;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 12px;
  background: #111827;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  user-select: none;
}

#volume-bar .vb-stat {
  font-weight: 500;
  white-space: nowrap;
}

#volume-bar .vb-sep {
  color: #6b7280;
  font-weight: 400;
}

#volume-bar .vb-hint {
  color: #9ca3af;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

#volume-bar #vb-toggle {
  margin-left: 4px;
  padding: 4px 10px;
  background: #76b900;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 11px;
  line-height: 1;
}

#volume-bar #vb-toggle:hover {
  background: #5d9100;
}

/* Legend panel (collapsible) */

#volume-legend {
  position: fixed;
  bottom: 56px;
  left: 12px;
  z-index: 9998;
  width: 380px;
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  color: #1f2937;
}

#volume-legend[data-state="collapsed"] {
  display: none;
}

#volume-legend header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

#volume-legend h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#volume-legend h2 .vb-close {
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  color: #6b7280;
  padding: 0 6px;
  line-height: 1;
}

#volume-legend .vb-subtitle {
  font-size: 11px;
  color: #6b7280;
  margin: 0;
}

#vb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

#vb-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  padding: 6px 4px;
  border-top: 1px solid #f3f4f6;
  cursor: pointer;
  align-items: center;
}

#vb-list li:first-child {
  border-top: none;
}

#vb-list li:hover {
  background: #f9fafb;
}

#vb-list li.selected {
  background: #ecfdf5;
}

#vb-list li.selected .vb-bar-fill {
  background: #5d9100;
}

.vb-name {
  grid-column: 1;
  grid-row: 1;
  font-size: 11.5px;
  font-weight: 500;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vb-rows {
  grid-column: 2;
  grid-row: 1;
  font-size: 11px;
  color: #374151;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.vb-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
}

.vb-bar-fill {
  display: block;
  height: 100%;
  background: #76b900;
  border-radius: 3px;
}

/* Stage color badges (small dot left of name) */
.vb-stage-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.vb-stage-SFT { background: #76b900; }   /* NVIDIA green — SFT dominates */
.vb-stage-RL  { background: #6366f1; }   /* indigo — RL */
.vb-stage-RM  { background: #f59e0b; }   /* amber — RM */
