/* Keep workspace identity and account actions visible as the editor narrows. */
#teamControls:empty { display: none; }
#teamControls .rst-context { display: none; }
.top:has(#teamControls:not(:empty)) { min-height: 70px; height: auto; padding-block: 10px; }
.top:has(#teamControls:not(:empty)) #workspaceName {
  display: block; max-width: 22ch; overflow-wrap: anywhere; font-weight: 650; color: var(--sage);
}
#teamControls .rst-controls { gap: 5px; }
#syncInfo { min-height: 24px; padding: 2px 8px; color: #773d21; border-color: #d9b299; }

/* In a narrow sidebar, four visible tabs need two rows to retain legible labels. */
.tabs:has(#ordersTab:not([hidden])) {
  display: grid; grid-template-columns: 1fr 1fr;
}
.tabs:has(#ordersTab:not([hidden])) button { min-width: 0; }

.viewer .room-actions, .viewer .history, .viewer .sidetip,
.viewer #libraryTab, .viewer #editTab, .viewer #library, .viewer #inspector,
.viewer #renameBtn i { display: none !important; }
.viewer #renameBtn:disabled { opacity: 1; cursor: default; }
.viewer .diagram-object { cursor: default; }
.viewer .board.measuring .diagram-object { cursor: crosshair; }

@media (max-width: 980px) {
  .top:has(#teamControls:not(:empty)) {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 10px; row-gap: 6px; padding-block: 8px;
  }
  .top:has(#teamControls:not(:empty)) .brand { grid-column: 1; grid-row: 1; }
  .top:has(#teamControls:not(:empty)) .top-actions { grid-column: 3; grid-row: 1; }
  .top:has(#teamControls:not(:empty)) #workspaceName { grid-column: 1 / 3; grid-row: 2; max-width: none; border: 0; padding: 0; }
  #teamControls:not(:empty) { grid-column: 3; grid-row: 2; justify-self: end; }
  #teamControls .rst-controls { justify-content: flex-end; }
}
@media (max-width: 620px) {
  .top:has(#teamControls:not(:empty)) { grid-template-columns: minmax(0, 1fr) auto; }
  .top:has(#teamControls:not(:empty)) .top-actions, #teamControls:not(:empty) { grid-column: 2; }
  .top:has(#teamControls:not(:empty)) #workspaceName { grid-column: 1; font-size: 11px; }
  #teamControls .rst-button { padding: 4px 6px; font-size: 11px; }
  .tabs:has(#ordersTab:not([hidden])) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .viewer .tabs:has(#ordersTab:not([hidden])) { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .top:has(#teamControls:not(:empty)) .top-actions button { padding: 5px; }
  .top:has(#teamControls:not(:empty)) #workspaceName { grid-column: 1 / -1; }
  #teamControls:not(:empty) { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
}
