.sv-space-switch,
.sv-space-location {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

html:not([data-space-workbench]) #spaceHeaderSwitch { display: none !important; }
html[data-space-workbench] .workspace-heading h1 { order: 0; }
html[data-space-workbench] .workspace-heading #spaceHeaderSwitch { order: 1; }
html[data-space-workbench] .workspace-heading time { order: 2; }
html[data-space-workbench] .workspace-heading #workspaceSwitcher { order: 3; }
.sv-team-host-dialog { width: min(440px, calc(100vw - 40px)); padding: 28px; border: 1px solid #34363a; border-radius: 14px; background: var(--sv-color-surface, #161719); color: var(--sv-color-text, #f2f3f2); }
.sv-team-host-dialog::backdrop { background: #0009; }
.sv-team-host-dialog h2 { margin: 0 0 12px; font-size: 20px; }
.sv-team-host-dialog p { font-size: 13px; line-height: 1.7; opacity: .7; }
.sv-team-host-dialog label { display: grid; gap: 10px; font-size: 13px; margin: 24px 0 12px; }
.sv-team-host-dialog input { box-sizing: border-box; width: 100%; padding: 12px; background: transparent; border: 1px solid #7776; border-radius: 8px; color: inherit; font: inherit; }
.sv-team-host-dialog footer { display: flex; justify-content: flex-end; gap: 12px; }
.sv-team-host-dialog button { padding: 9px 16px; border: 1px solid #7776; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.sv-team-host-dialog button[type=submit] { background: #d4ff00; color: #111; border-color: transparent; }

/* The desktop trigger lives above the web content, beside the window title. */
html[data-desktop-space-caption] #spaceHeaderSwitch {
  position: absolute;
  width: 0;
  height: 0;
}

html[data-desktop-space-caption] #spaceHeaderSwitch > :not(.sv-space-switch-menu) {
  display: none;
}

html[data-desktop-space-caption] .sv-space-resident {
  position: absolute;
  inset: 0 auto auto 0;
  width: 0;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.sv-space-switch-menu.is-caption-menu {
  position: fixed;
  top: 8px;
  z-index: 10000;
}

.sv-header-actions .sv-space-location,
.hub-topbar-actions .sv-space-location {
  flex: 0 0 auto;
}

.sv-space-switch-button,
.sv-space-location-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--sv-color-border, rgba(128,128,128,.18));
  border-radius: 18px;
  background: var(--sv-color-surface, rgba(128,128,128,.06));
  color: var(--sv-color-text, inherit);
  font: inherit;
  cursor: pointer;
}

.sv-space-switch-button strong,
.sv-space-location-button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.sv-space-location-button strong {
  font-size: 13px;
  font-weight: 560;
}

.workspace-heading .sv-space-switch-button svg,
.hub-topbar-actions .sv-space-location-button svg {
  transform: none;
}

.sv-space-switch-chevron,
.sv-space-location-icon,
.sv-space-switch-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sv-space-switch-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.72;
}

.sv-space-location-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.sv-space-location-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sv-color-brand, #c8f54a);
  flex: 0 0 auto;
}

.sv-space-location-dot[data-status="offline"] {
  background: #8d8d8d;
}

.sv-space-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 80;
  width: min(248px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #17181b;
  color: #f5f6f5;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.sv-space-location-menu {
  left: auto;
  right: 0;
}

.sv-space-switch-kicker {
  margin: 6px 12px 8px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.sv-space-switch-item,
.sv-space-switch-join {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  box-sizing: border-box;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.sv-space-switch-item:hover,
.sv-space-switch-join:hover,
.sv-space-switch-item[aria-current="true"] {
  background: rgba(255, 255, 255, 0.06);
}

.sv-space-switch-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 28px;
  background: transparent;
}

.sv-space-switch-icon svg {
  width: 18px;
  height: 18px;
}

.sv-space-switch-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sv-space-switch-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 620;
}

.sv-space-switch-copy small {
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
}

.sv-space-switch-check {
  color: var(--sv-color-brand, #c8f54a);
  font-size: 15px;
  line-height: 1;
}

.sv-space-switch-join {
  grid-template-columns: 24px minmax(0, 1fr);
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  padding-top: 12px;
}

.sv-space-switch-item--plain {
  grid-template-columns: minmax(0, 1fr) 18px;
}

.sv-space-switch-item--plain .sv-space-switch-icon {
  display: none;
}

.sv-space-switch-status:empty {
  display: none;
}

.hub-topbar {
  overflow: visible;
}

.hub-topbar .sv-space-switch-status {
  display: none;
}

.sv-space-resident {
  position: fixed;
  top: 10px;
  left: calc(var(--app-rail-width, 64px) + 16px);
  right: 22px;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
  margin: 0;
  pointer-events: none;
}

.sv-space-resident .sv-space-switch,
.sv-space-resident .sv-space-location {
  pointer-events: auto;
}

html:not([data-desktop-space-caption]) body:has(.sv-space-resident) > :is(.skills-shell, .kb-layout, .fm-shell, .planner-shell, .cc-shell, main) {
  padding-top: 46px;
}

#spaceHeaderSwitchList { display: grid; }

.workspace-heading .sv-space-switch-menu .sv-space-switch-item {
  display: grid;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.workspace-heading .sv-space-switch-menu .sv-space-switch-item svg {
  width: 18px;
  height: 18px;
  transform: none;
}

.sv-space-switch-menu[hidden] { display: none; }
.sv-space-switch-button { transition: background .16s, border-color .16s; }
.sv-space-switch-button:hover,
.sv-space-switch-button[aria-expanded="true"] { background: rgba(128,128,128,.14); }
.sv-space-switch-button:focus-visible,
.sv-space-switch-menu :is(button,a):focus-visible { outline: 2px solid var(--sv-color-brand, #c8f54a); outline-offset: 3px; }
