fix criteria for document categories in sidebar

• document categories check for custom list elements need to exclude externally managed documents like query itself
• show name including hint that category is externally managed
fix whitespace and tabs