/**
 * GLOBAL topbar construct — layout, slots, sizing, z-index, ellipsis.
 * Colours / backgrounds / radii live in site pack css/topbar-skin.css.
 * Height token: --tb-topbar-height (48px). Nested .mve-topbar uses the same token.
 */
:root {
  --tb-topbar-height: 48px;
  --mve-user-topbar-height: var(--tb-topbar-height);
}

body.admin-has-slideshow .admin-topbar {
  z-index: 101;
}

body.admin-has-slideshow .wrap,
body.admin-has-slideshow #adminApp,
body.admin-has-slideshow .sysdoc-wrap {
  position: relative;
  z-index: 1;
}

.admin-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tb-topbar-height);
  height: var(--tb-topbar-height);
  padding: 0 16px;
  box-sizing: border-box;
  overflow: visible;
}

/* Progress bars (#wlExportProgress, #tbTopbarProgress, etc.) need a positioned .left. */
.admin-topbar .left {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
  overflow: visible;
}

.admin-topbar .mve-topbar {
  z-index: auto;
  min-height: 0;
}

.admin-topbar .mve-topbar--group-flyout {
  --mve-flyout-max-w-px: 260px;
  --mve-flyout-max-w-vw-frac: 0.35;
  --mve-flyout-max-h-px: 420px;
}

.admin-topbar-middle {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.admin-topbar .right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Ordered RHS cluster — insertions target data-topbar-cluster slots, not plan-pill anchors. */
.admin-topbar-rhs-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.admin-user-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(40vw, 320px);
}

.admin-user-plan-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(30vw, 220px);
  text-decoration: none;
  font-weight: 600;
}

.admin-topbar-tool-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.admin-topbar-tool-slot .scene-component-count-hud {
  position: static;
  top: auto;
  left: auto;
  z-index: auto;
  pointer-events: none;
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-topbar-tool-slot .al-transport-perf-row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

.admin-topbar-tool-slot .al-transport-perf-pill {
  font-size: 10px;
  line-height: 1.2;
  padding: 2px 6px;
  white-space: nowrap;
}

.admin-clock {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-family: ui-monospace, monospace;
}

/* Profile-driven clock hide (replaces 6 per-lab duplicate rules). */
#adminTopbar[data-topbar-profile="lab"] #adminClock,
#adminTopbar[data-topbar-profile="lab"] .admin-clock {
  display: none !important;
}

/* Lab profile: no plan / credits pills (markup may still exist on some shells). */
#adminTopbar[data-topbar-profile="lab"] #adminUserPlanPill,
#adminTopbar[data-topbar-profile="lab"] .admin-user-plan-pill,
#adminTopbar[data-topbar-profile="lab"] .credits-wallet-pill {
  display: none !important;
}

.health-strip-cluster {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.health-strip-cluster .admin-ffmpeg-cluster {
  position: relative;
  flex-shrink: 0;
}

.health-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.health-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  cursor: default;
}

.health-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.admin-lib-versions {
  font-size: 11px;
  font-family: inherit;
  max-width: min(42vw, 380px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-tb-release {
  cursor: help;
}

.admin-ffmpeg-loading {
  opacity: 0.75;
  font-size: 11px;
}

.admin-ffmpeg-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  line-height: 1.25;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

/* Public site pack topbar (.tb-site-topbar) — construct only. */
body.tb-site-default.tb-site-has-topbar {
  padding-top: var(--tb-topbar-height);
}

.tb-site-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--tb-topbar-height);
  padding: 0 1rem;
  box-sizing: border-box;
}

.tb-site-topbar__brand {
  display: block;
  line-height: 0;
  text-decoration: none;
  flex: 0 0 auto;
}

.tb-site-topbar__nav {
  flex: 0 0 auto;
  margin-left: auto;
}

.tb-site-topbar__nav--menu {
  margin-left: auto;
}

.tb-site-topbar__nav--account {
  margin-left: 0;
}

.tb-site-topbar__nav--menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.tb-site-topbar__nav--menu li {
  margin: 0;
  padding: 0;
}

.tb-site-topbar__nav--menu a,
.tb-site-topbar__nav--menu span {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
}

.tb-site-topbar__nav--menu a:hover {
  text-decoration: underline;
}

.tb-site-topbar__nav-link {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
}

.tb-site-topbar__nav-link:hover {
  text-decoration: underline;
}

.tb-site-topbar__logo {
  display: block;
  max-height: 32px;
  width: auto;
  height: auto;
  vertical-align: middle;
}

/*
 * Public pack topbar also carries .admin-topbar + #adminTopbar for boot-glow.
 * Keep public stack/padding (over slideshow z-index:1) instead of lab chrome.
 */
.tb-site-topbar.admin-topbar {
  z-index: 3;
  height: auto;
  min-height: var(--tb-topbar-height);
  padding: 0 1rem;
  gap: 1rem;
}

/* Public menu flyouts (formerly in site.css). */
.tb-site-topbar__nav--menu .mve-topbar__list {
  display: block;
}

.tb-site-topbar__nav--menu .mve-topbar__group-row {
  display: block;
}

.tb-site-topbar__nav--menu .mve-topbar__panel {
  left: auto;
  right: 0;
}

/* Shared lab control radius markers (geometry only; packs may recolour). */
.al-top-bar-radius,
.wl-top-bar-radius,
.vl-top-bar-radius,
.ll-top-bar-radius,
.ml-top-bar-radius {
  border-radius: 3px;
}

.al-transport-radius,
.wl-transport-radius,
.vl-transport-radius,
.ll-transport-radius {
  border-radius: 3px;
}
