/* Agent Stage — Excel-/Acrobat-style tab bar (Home anchor tab plus one
 * chip per open artifact/source in the workset).
 * Active indicator: 2px brand-blue underline.
 *
 * Loads AFTER components/agent_stage.css (stylesheets link in
 * alphabetical logical-path order) — agent_stage.css layers its
 * stage-specific overrides on top via compound selectors, keep the
 * relative order intact when renaming either file.
 */

.stage-tab-bar {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-bottom: 1px solid var(--tblr-border-color, #e6e7e9);
  /* overflow-x: auto implicitly upgrades overflow-y from visible to auto
     (CSS spec). With our 1px content/padding/border mismatch the browser
     would paint a vertical scrollbar at the right edge. clip prevents
     that without disabling horizontal scrolling. */
  overflow-x: auto;
  overflow-y: clip;
  scrollbar-width: thin;
  margin-top: 0.5rem;
}

.stage-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.875rem;
  border: none;
  background: transparent;
  color: var(--tblr-secondary, #626976);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; /* overlaps the bar's bottom border so active underline aligns */
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.stage-tab:hover {
  background-color: rgba(2, 108, 255, 0.06);
  color: var(--tblr-body-color, #1d273b);
}

.stage-tab--active {
  color: #026CFF;
  border-bottom-color: #026CFF;
  background-color: rgba(2, 108, 255, 0.04);
}

.stage-tab--anchor {
  font-weight: 600;
}

.stage-tab__activator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-width: 0; /* let the label truncate inside flex */
}

.stage-tab__label {
  display: inline-block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.stage-tab__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 0.25rem;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--tblr-secondary, #626976);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background-color 0.12s ease;
}

.stage-tab:hover .stage-tab__close,
.stage-tab--active .stage-tab__close {
  opacity: 0.7;
}

.stage-tab__close:hover {
  opacity: 1;
  background-color: rgba(220, 53, 69, 0.12);
  color: var(--tblr-danger, #d63939);
}
