/* Cursor-like unified tab chrome for Messages campaign tabs + project agent tabs.
   Active fill = Chat history selection grey (--ty-tab-active). Plus is a bare + (no dashed box). */

html body .msg-tabs-bar,
html body .ty-tabs-bar,
html body .ty-agent-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  flex: 0 0 auto !important;
  min-height: 40px !important;
  padding: 6px 12px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
  background: var(--ty-tab-bar-bg, #1F2121) !important;
  border-bottom: 1px solid var(--ty-tab-bar-border, rgba(255, 255, 255, 0.06)) !important;
  position: relative;
  z-index: 2;
}
html body .msg-tabs-bar::-webkit-scrollbar,
html body .ty-tabs-bar::-webkit-scrollbar,
html body .ty-agent-tabs::-webkit-scrollbar {
  display: none;
}

html body .msg-tab,
html body .ty-tab {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  max-width: 220px;
  padding: 6px 10px !important;
  margin: 0 !important;
  border: none !important;
  border-bottom: none !important;
  border-radius: var(--ty-tab-radius, 6px) !important;
  background: transparent !important;
  color: var(--ty-tab-ink, rgba(200, 201, 204, 0.72)) !important;
  font: inherit;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 120ms ease, background 120ms ease;
}
html body .msg-tab:hover,
html body .ty-tab:hover {
  color: var(--ty-tab-ink-active, #f5f5f7) !important;
  background: var(--ty-tab-hover, rgba(255, 255, 255, 0.04)) !important;
}
html body .msg-tab.is-active,
html body .ty-tab.is-active {
  color: var(--ty-tab-ink-active, #f5f5f7) !important;
  background: var(--ty-tab-active, rgba(255, 255, 255, 0.09)) !important;
  border-bottom-color: transparent !important;
  font-weight: 560 !important;
}
html body .msg-tab.is-active svg,
html body .ty-tab.is-active svg {
  color: inherit !important;
}

html body .msg-tab-close,
html body .ty-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: currentColor;
  opacity: 0.45;
  cursor: pointer;
  flex: 0 0 auto;
}
html body .msg-tab-close:hover,
html body .ty-tab-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

/* Cursor-like + : bare glyph, no dashed square */
html body .msg-tab-add,
html body .ty-tab-add {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  margin: 0 0 0 4px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: var(--ty-tab-radius, 6px) !important;
  background: transparent !important;
  color: var(--ty-tab-plus, rgba(200, 201, 204, 0.78)) !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  cursor: pointer;
  flex: 0 0 auto;
  transition: color 120ms ease, background 120ms ease;
}
html body .msg-tab-add:hover,
html body .ty-tab-add:hover {
  color: var(--ty-tab-plus-hover, #f5f5f7) !important;
  background: var(--ty-tab-hover, rgba(255, 255, 255, 0.04)) !important;
  border-color: transparent !important;
}
html[data-app-theme="dark"] body .msg-tab-add,
html[data-app-theme="dark"] body .ty-tab-add {
  border: none !important;
  border-color: transparent !important;
}

/* Agent tabs: main workspace header (#topbar), full-bleed — not inside
   the centered Ask column (that put them above the composer). */
html body.ty-has-agent-tabs header.topbar#topbar,
html body.ty-has-agent-tabs header.topbar.topbar--no-header,
html body.ty-has-agent-tabs header.topbar.topbar--with-pill.topbar--no-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  height: auto !important;
  min-height: 40px !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--ty-tab-bar-border, rgba(255, 255, 255, 0.06)) !important;
  overflow: visible !important;
  pointer-events: auto !important;
  visibility: visible !important;
  background: var(--ty-tab-bar-bg, #1F2121) !important;
  background-image: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  position: relative !important;
  z-index: 4;
}
html body.ty-has-agent-tabs header.topbar#topbar > .topbar-left,
html body.ty-has-agent-tabs header.topbar#topbar > .topbar-right,
html body.ty-has-agent-tabs header.topbar#topbar > #gl-floating-pill {
  display: none !important;
}
html body.ty-has-agent-tabs header.topbar #ty-agent-tabs,
html body.ty-has-agent-tabs header.topbar .ty-agent-tabs {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  order: 0 !important;
  border-bottom: none !important;
  background: transparent !important;
}
/* Never leave a stray bar inside the Ask stack if remount races. */
html body .ai-view > .ty-agent-tabs {
  display: none !important;
}

/* Sidebar Projects block (between Predictions and Chat history) */
html body aside.sidebar#sidebar .sidebar-projects {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 14px 0 14px;
  padding: 0 2px;
}
html body aside.sidebar#sidebar .sidebar-projects-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  padding: 0 8px 0 10px;
  color: var(--fg-muted, #8A8F9C);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
html body aside.sidebar#sidebar .sidebar-projects-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
html body aside.sidebar#sidebar .sidebar-projects-add:hover {
  color: var(--fg-primary, #E3E1DD);
  background: var(--ty-tab-hover, rgba(255, 255, 255, 0.04));
}
html body aside.sidebar#sidebar .sidebar-projects-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}
html body aside.sidebar#sidebar .sidebar-project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 8px 0 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-secondary, #B5B7BE);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
html body aside.sidebar#sidebar .sidebar-project-item:hover {
  background: var(--ty-tab-hover, rgba(255, 255, 255, 0.04));
  color: var(--fg-primary, #E3E1DD);
}
html body aside.sidebar#sidebar .sidebar-project-item.is-active {
  background: var(--ty-tab-active, rgba(255, 255, 255, 0.09));
  color: #FFF;
}
html body aside.sidebar#sidebar .sidebar-project-item .sqi-icon {
  width: 18px;
  min-width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}
html body aside.sidebar#sidebar .sidebar-project-item .sqi-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html body aside.sidebar#sidebar .sidebar-project-item .sidebar-project-ago {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--fg-muted, #8A8F9C);
}
html body aside.sidebar#sidebar .sidebar-projects-empty {
  padding: 6px 10px 4px;
  font-size: 12px;
  color: var(--fg-muted, #8A8F9C);
}

/* Collapsed rail: hide project labels / section chrome; keep New chat + project dots */
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-projects-head,
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-projects-empty,
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-project-item .sqi-label,
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-project-item .sidebar-project-ago,
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-quick-item--newchat .sqi-label {
  display: none !important;
}
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-projects {
  margin: 8px 0;
  align-items: center;
  padding: 0;
}
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-project-item {
  width: 40px;
  max-width: 40px;
  margin: 0 auto;
  padding: 0;
  gap: 0;
  justify-content: center;
}
html body.sidebar-collapsed aside.sidebar#sidebar .sidebar-quick-item--newchat {
  width: 40px !important;
  max-width: 40px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  gap: 0 !important;
  justify-content: center !important;
}

/* Extra breathing room around Projects vs Predictions / Chat history */
html body aside.sidebar#sidebar .sidebar-quick-nav--v1929 .sidebar-quick-item[data-route="/predictions"] {
  margin-bottom: 2px !important;
}
html body aside.sidebar#sidebar .sidebar-projects + .sidebar-quick-item--history,
html body aside.sidebar#sidebar #sidebar-projects-host + #sqi-history {
  margin-top: 0 !important;
}
