/* Chat tabs — browser-style folder tabs above the thread */
.ws-tabs {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 8px clamp(10px, 2vw, 16px) 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.ws-tab-scroll {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 0;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 2px;
}
.ws-tab-scroll::-webkit-scrollbar { display: none; }
.ws-tab {
  --tab-r: 10px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 1 auto;
  width: 168px;
  max-width: 168px;
  min-width: 96px;
  height: 34px;
  padding: 0 8px 0 10px;
  margin: 0 -1px -1px 0;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--tab-r) var(--tab-r) 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  z-index: 0;
  transition: color 0.12s, background 0.12s;
}
/* Hover (inactive only) — whisper wash; selected tab stays the only solid surface */
.ws-tab:not(.is-active):hover {
  z-index: 1;
  color: var(--ink2);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border-color: transparent;
}
/* Selected — solid thread surface; hover does not restyle it */
.ws-tab.is-active,
.ws-tab.is-active:hover {
  z-index: 2;
  color: var(--ink);
  background: var(--bg);
  border-color: var(--line);
  border-bottom-color: transparent;
}
/* Chrome-style vertical dividers between inactive tabs (hidden beside active/hover) */
.ws-tab:not(.is-active)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  background: var(--line);
  pointer-events: none;
  opacity: 0.95;
}
.ws-tab:not(.is-active):has(+ .ws-tab.is-active)::after,
.ws-tab:not(.is-active):hover::after,
.ws-tab:not(.is-active):has(+ .ws-tab:hover)::after,
.ws-tab:not(.is-active):has(+ .ws-tab-new)::after {
  opacity: 0;
}

/* Soft “ears” so the active tab reads as attached to the page */
.ws-tab.is-active::before,
.ws-tab.is-active::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 10px;
  pointer-events: none;
  transform: none;
  opacity: 1;
  background: none;
}
.ws-tab.is-active::before {
  left: -10px;
  top: auto;
  right: auto;
  background: radial-gradient(circle at 0 0, transparent 9.5px, var(--bg) 10px);
}
.ws-tab.is-active::after {
  right: -10px;
  left: auto;
  top: auto;
  background: radial-gradient(circle at 100% 0, transparent 9.5px, var(--bg) 10px);
}
.ws-tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.ws-tab-edit {
  flex: 1;
  min-width: 4rem;
  max-width: 140px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--ember);
  border-radius: 8px;
  padding: 2px 6px;
  outline: none;
}
.ws-tab-edit:focus {
  box-shadow: var(--focus-ring);
}

/* Right-click / long-press tab menu */
.ws-tab-menu {
  position: fixed;
  z-index: 120;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  /* Light: warm chat cream (not stark --card white) */
  background: var(--bg);
  box-shadow: var(--shadow-overlay);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
:root[data-mode="dark"] .ws-tab-menu{box-shadow:var(--d-shadow-pop)}
.ws-tab-menu-item {
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.ws-tab-menu-item:hover:not(:disabled) {
  background: var(--hover);
}
.ws-tab-menu-item.is-danger {
  color: var(--emberL);
}
.ws-tab-menu-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ws-tab-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}
.ws-tab-ico {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.ws-tab-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  padding: 0;
  margin: 0 -4px 0 0;
}
.ws-tab:hover .ws-tab-close,
.ws-tab.is-active .ws-tab-close,
.ws-tab:focus-within .ws-tab-close {
  opacity: 1;
}
.ws-tab-close:hover {
  background: var(--hover);
  color: var(--ink);
}
.ws-tab-close:disabled,
.ws-tab-close[disabled] {
  opacity: 0 !important;
  pointer-events: none;
}
.ws-tab .ws-spin,
.ws-tab .ws-dot {
  flex-shrink: 0;
}
.ws-spin {
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--muted);
  border-top-color: transparent;
  border-radius: 999px;
  flex-shrink: 0;
  opacity: 0.7;
  animation: ws-spin 1.2s linear infinite;
}
@keyframes ws-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ws-spin {
    animation: none;
    border-color: var(--muted);
    border-top-color: transparent;
    opacity: 0.55;
  }
}
.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  flex-shrink: 0;
  animation: ws-dot 0.35s ease both;
}
@keyframes ws-dot {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-dot { animation: none; }
}
.ws-tab-pin {
  font-size: 9px;
  color: var(--gold);
  flex-shrink: 0;
}
.ws-tab-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
  font-style: italic;
  font-family: "Fraunces", serif;
}
/* New chat + — match design/workspace (do not use legacy .tabnew) */
.ws-tab-new {
  position: relative;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  margin: 0 0 3px 10px;
  padding: 0;
  outline: none;
  box-shadow: none;
}
.ws-tab-new::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  background: var(--line);
  opacity: 0.95;
  pointer-events: none;
}
.ws-tab.is-active + .ws-tab-new::before,
.ws-tab:hover + .ws-tab-new::before {
  opacity: 0;
}
/* Light hover: soft wash + hairline (design) */
.ws-tab-new:hover {
  background: color-mix(in srgb, var(--card) 70%, transparent);
  color: var(--ink);
  border-color: var(--line);
}.ws-tab-new:disabled {
  opacity: 0.45;
  cursor: default;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.ws-tab-new:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.ws-thread {
  flex: 1 0 auto;
  overflow: visible;
  padding: 20px 0 8px;
}

.ws-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

