.tabBar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  /* Pin to the shared second-row height so the right-sidebar tab bar (when
   * pushed under a PR banner) bottoms out at the same Y as this strip. */
  min-height: var(--tab-bar-h);
}

.tabBar::-webkit-scrollbar {
  height: var(--scrollbar-size);
}

.tabBar::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-sm);
}

.tabBar::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-width: 0;
  max-width: 220px;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  /* `grab` advertises drag-to-reorder; the dragging state below switches to
   * `grabbing`. */
  cursor: grab;
  white-space: nowrap;
  /* WebKit (macOS Tauri) honors only the prefixed -webkit-user-select. The
   * unprefixed property silently defaults to "text" on `<span>` descendants
   * even when the parent says "none", which lets the browser start a text
   * selection on mousedown before our pointer-capture fires and visually
   * "highlights" the tab name mid-drag. Set both. */
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  transition: color 80ms ease;
}

.tab:first-child {
  padding-left: 8px;
}

.tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: transparent;
  transition: background 80ms ease;
}

.tab:hover:not(.active) {
  color: var(--text-primary);
}

.active {
  color: var(--text-primary);
}

.active::after {
  background: var(--accent-primary);
}

.icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  opacity: 0.75;
}

.active .icon {
  opacity: 1;
}

.icon.pulse {
  opacity: 1;
}

.name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Unsaved-changes indicator on file tabs (VS Code convention). Renders to
 * the right of the basename inside the same .name span. */
.dirtyDot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  vertical-align: middle;
}

/* "File changed on disk" indicator. Shown when an external write lands
 * while the buffer is dirty — the watcher leaves the user's edits in
 * place and raises this flag instead. Distinct from `.dirtyDot`: hollow
 * (just a ring) and uses the in-progress / needs-attention hue rather
 * than the accent so the two states never visually fuse when both apply. */
.externalDot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1.5px solid var(--tool-task);
  background: transparent;
  vertical-align: middle;
}

.fileStatus {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
}

.nameInput {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: 1px solid var(--accent-primary);
  border-radius: 3px;
  padding: 0 2px;
  font: inherit;
  color: var(--text-primary);
}

.nameInput[aria-invalid="true"] {
  outline-color: var(--status-error);
}

.closeBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 80ms ease, background 80ms ease, color 80ms ease;
}

.tab:hover .closeBtn,
.tab:focus-within .closeBtn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.closeBtn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.addBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin-left: 2px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 80ms ease;
  flex-shrink: 0;
}

.addBtn:hover:not(:disabled) {
  color: var(--text-primary);
}

.addBtn:disabled {
  cursor: default;
  opacity: 0.5;
}

/* While a tab drag is in progress, force the grabbing cursor and suppress
 * hover styles on non-target tabs so the drop indicator is the only visible
 * feedback. Mirrors the terminal tab bar's drag state. */
.tabBar[data-tab-dragging="true"] {
  cursor: grabbing;
}
.tabBar[data-tab-dragging="true"] .tab:hover:not(.active) {
  color: inherit;
}

.tab.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

/* Drop-edge indicator. Sibling spans (not pseudo-elements) because the tab
 * already uses `::after` for the active-underline; we don't want the two
 * effects fighting for the same pseudo. The accent bar matches the
 * terminal tab bar's drop indicator for visual consistency. */
.dropEdge {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent-primary);
  border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(var(--accent-primary-rgb), 0.25);
}
.dropBefore {
  left: -2px;
}
.dropAfter {
  right: -2px;
}
