.tabs {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;      /* legacy Edge */
}
.tabs::-webkit-scrollbar { display: none; }  /* Chromium / WebKit */

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: calc(var(--header-h) - 8px);
  padding: 0 10px 0 12px;
  margin-top: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--fg-muted);
  font-size: 12.5px;
  max-width: 220px;
  position: relative;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  user-select: none;
}
.tab:hover { color: var(--fg); }
.tab.is-active {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--border-strong);
}
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #4c5cff);
  border-radius: 2px;
}

.tab__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--fg-dim);
  flex: 0 0 auto;
}
.tab.is-running .tab__dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.tab.is-exited .tab__dot  { background: var(--danger); }

.tab__title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
}

.tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  flex: 0 0 auto;
  box-shadow: 0 0 8px var(--accent-soft);
}
.tab__badge[hidden] { display: none; }
.tab[data-colored] .tab__badge {
  background: var(--tab-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--tab-color) 50%, transparent);
}

/* Closing a tab is workspace-loss territory per the persistence
   invariant, so the hit area has to be generous on touch. Visible chip
   stays compact (18×18) via the inner ::before; padding expands the hit
   target up to a 36×36 box that comfortably clears the WCAG 2.5.5
   minimum without enlarging the visual control. */
.tab__close {
  width: 36px; height: 36px;
  padding: 9px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1;
  background-clip: content-box;
}
.tab__close:hover { background: var(--surface-3); color: var(--fg); }

/* Colored tab variant — set via data-colored="1" + --tab-color inline. */
.tab[data-colored] .tab__dot {
  background: var(--tab-color);
  box-shadow: 0 0 6px var(--tab-color);
}
.tab[data-colored].is-active::after {
  background: var(--tab-color);
}
.tab[data-colored].is-active {
  border-top: 1px solid color-mix(in srgb, var(--tab-color) 50%, transparent);
}

/* Inline rename input — looks seamless inside the tab. */
.tab__title-input {
  font: inherit;
  color: var(--fg);
  background: var(--surface-3);
  border: 1px solid var(--accent-soft);
  outline: none;
  border-radius: 3px;
  padding: 1px 4px;
  margin: 0;
  width: 160px;
  min-width: 60px;
  height: 22px;
}
.tab__title-input:focus { border-color: var(--accent); }
