/* ===================================================================
   Header  -  fixed corner clusters, transparent gap in between
=================================================================== */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 46px;
  display: flex; align-items: stretch;
  pointer-events: none;
  background: transparent;
}

#header-left {
  pointer-events: auto;
  position: absolute; left: 0; top: 0; height: 100%;
  width: 294px;   /* right edge aligned with the other left-side menus (.tb-left); identity name ellipsizes if tight */
  display: flex; align-items: center; gap: 6px;
  background: var(--glass-bg);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 1px solid var(--glass-border);
  border-top: none; border-left: none;
  border-radius: 0 0 12px 0;
  box-shadow: 2px 2px 12px rgba(0,0,0,0.08);
  padding: 0 16px;
}

/* ── Workspace/project separator ── */
.ws-proj-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
  flex-shrink: 0;
  margin: 0 4px;
}
/* #header-projects rule REMOVED 2026-07-30 (owner ruling: the projects[] tab strip is gone for
   good; see the comment at the former container site in index.html). The .proj-tab rules below
   stay: renderProjectTabs() markup would still use them IF a future owner decision ever revives
   the strip, and removing them costs nothing while orphaned. */
.proj-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 22px 3px 9px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--dim);
  background: rgba(240,237,232,0.6);
  border: 1px solid rgba(180,175,168,0.35);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  user-select: none;
  flex-shrink: 0;
  height: 22px;
  box-sizing: border-box;
}
.proj-tab-label {
  display: block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-tab:hover { background: rgba(255,255,255,0.85); }
.proj-tab.active {
  background: rgba(255,255,255,0.95);
  color: var(--txt);
  font-weight: 600;
  border-color: rgba(140,135,128,0.5);
}
.proj-tab-close {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--faint);
  cursor: pointer;
  line-height: 1;
  padding: 1px 2px;
  border-radius: 2px;
}
.proj-tab-close:hover { color: var(--txt); background: rgba(0,0,0,0.08); }
.proj-tab-add {
  padding: 3px 7px;
  font-size: 12px;
  color: var(--faint);
  cursor: pointer;
  border: 1px dashed rgba(180,175,168,0.5);
  border-radius: 4px;
  background: transparent;
  line-height: 1;
  flex-shrink: 0;
  height: 22px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  transition: color 0.1s, border-color 0.1s;
}
.proj-tab-add:hover { color: var(--blue); border-color: var(--blue); }
.proj-rename-input {
  background: var(--bg0);
  border: 1px solid var(--blue);
  color: var(--txt);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  outline: none;
  width: 90px;
  height: 18px;
  box-sizing: border-box;
}


#subtab-bar {
  /* Owner 2026-10-02: wraps instead of scrolling behind a hidden scrollbar (centred + overflowing
     also made the leftmost sub-tabs unreachable). */
  min-height: 32px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--glass-bg);
  /* Owner 2026-09-20: glued to the workspace bar above (margin cancels #studio-panel's 8px gap) and
     bottom corners rounded like the other Studio divs. */
  margin-top: -8px;
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 3px 10px;
  flex-shrink: 0;
  scrollbar-width: none;
}
#subtab-bar::-webkit-scrollbar { display: none; }

#header-right {
  pointer-events: auto;
  position: absolute; right: 0; top: 0; height: 100%;
  width: 294px;   /* reach to content column edge with small gap */
  display: flex; align-items: center; gap: 6px;
  justify-content: flex-end;
  background: var(--glass-bg);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 1px solid var(--glass-border);
  border-top: none; border-right: none;
  border-radius: 0 0 0 12px;
  box-shadow: -2px 2px 12px rgba(0,0,0,0.08);
  padding: 0 16px;
}
/* Pill-style header buttons  -  same visual language as Main/Following/Top Spot */
.hdr-pill-btn {
  padding: 6px 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--dim); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.13s, color 0.12s, background 0.12s;
  white-space: nowrap;
}
.hdr-pill-btn:hover { transform: scale(1.06); color: var(--txt); background: rgba(255,255,255,0.85); }
.hdr-pill-btn.active { color: var(--blue); background: rgba(255,255,255,0.85); border-color: rgba(53,116,196,0.3); }
.hdr-pill-dev  { color: #c05050; border-color: rgba(200,80,80,0.35); background: rgba(200,80,80,0.06); }
.hdr-pill-dev:hover { color: #a03030; background: rgba(200,80,80,0.12); }
.hdr-pill-admin { }
.hdr-pill-feed  { color: var(--blue); border-color: rgba(53,116,196,0.3); }
.hdr-pill-auth  { color: var(--blue); border-color: rgba(53,116,196,0.3); font-weight: 700; }
.hdr-pill-auth.active { background: rgba(53,116,196,0.12); }

/* Phase 11a: global header search removed; Result L: User in corner menu */

#server-status {
  font-size: 14px;
  color: var(--dim);
  cursor: default;
}

#btn-prefs-header {
  background: none;
  border: 1px solid transparent;
  color: rgba(120,115,108,0.65);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  white-space: nowrap;
  letter-spacing: 0.04em;
  margin-right: 8px;
}
#btn-prefs-header:hover {
  color: var(--dim);
  border-color: var(--line);
  background: rgba(255,255,255,0.7);
}


/* ── Phase 6: Working Spaces bar ──────────────────────────────────── */
#working-spaces-bar {
  display: flex;
  align-items: center;
  padding: 4px 8px 0;
  border-bottom: 1px solid var(--line);
  background: var(--glass-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
#working-spaces-bar::-webkit-scrollbar { display: none; }
#ws-tabs {
  /* Owner 2026-09-20: tabs spread across the full bar width (justified) instead of hugging the left.
     Owner 2026-10-02 (1366x768 laptop): the old min-width:max-content + hidden scrollbar silently cut
     every tab past the bar's edge ("Sagas" was cut even at 1440 wide). Tabs now shrink their side
     padding first, then wrap onto a second row; flex-grow on each tab keeps every row justified. */
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px;
  min-width: 0;
}
#ws-tabs > .ws-tab { flex: 1 0 auto; padding-inline: clamp(4px, 0.7vw, 12px); }
/* Set by _balanceWsTabs (js/04f-workspaces.js) when the tabs need more than one row. */
/* Equal-width tabs, --ws-cols per row, and every row CENTRED (owner 2026-10-06): a grid put a shorter last row on the
   left with the empty column on the right. */
#ws-tabs.ws-grid { display: flex; flex-wrap: wrap; justify-content: center; }
#ws-tabs.ws-grid > .ws-tab { flex: 0 0 calc((100% - (var(--ws-cols, 5) - 1) * 2px) / var(--ws-cols, 5) - 1px); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; }
#ws-tabs.ws-measure { flex-wrap: nowrap; }
/* Measured to fit one row (owner 2026-10-05): never wrap a lone tab onto a second row; shrink a touch instead. */
#ws-tabs.ws-onerow { flex-wrap: nowrap; }
#ws-tabs.ws-onerow > .ws-tab { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#ws-tabs.ws-measure > .ws-tab { flex: 0 0 auto; }
.ws-tab {
  padding: 5px 12px 6px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  cursor: pointer;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
  transition: color 0.12s, border-color 0.12s;
}
.ws-tab:hover { color: var(--dim); }
.ws-tab.active {
  color: var(--txt);
  border-bottom-color: hsl(145, 45%, 42%);
  font-weight: 700;
  background: linear-gradient(180deg, rgba(72, 185, 115, 0.10) 0%, rgba(72, 185, 115, 0.04) 100%);
}

/* ── Phase 6b: Sub-tab bar ──────────────────────────────────────────── */
/* Owner 2026-10-02: the names are short Roman numerals (I, II, III, IV - VI), so each button keeps a generous
   click area of its own. */
.subtab-btn {
  flex-shrink: 0;
  min-width: 56px; min-height: 24px; text-align: center;
  padding: 3px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-size: 11px;
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s, color 0.1s;
}
.subtab-btn:hover { background: rgba(255,255,255,0.1); color: var(--txt); }
.subtab-btn.active {
  background: linear-gradient(180deg, rgba(72, 185, 115, 0.14) 0%, rgba(72, 185, 115, 0.06) 100%);
  border-color: rgba(72, 185, 115, 0.40);
  color: hsl(145, 40%, 32%);
  font-weight: 600;
}
.subtab-new-btn {
  flex-shrink: 0;
  min-width: 40px; min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  font-size: 14px;
  color: var(--faint);
  cursor: pointer;
  line-height: 1;
  transition: color 0.1s, background 0.1s;
}
.subtab-new-btn:hover { color: var(--txt); background: rgba(255,255,255,0.1); }
