/* V16: global header only. Do not affect .top-actions inside forms or booking pages. */
.pencil-admin .topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, auto);
  align-items: center;
  gap: 16px 24px;
}
.pencil-admin .topbar > div:first-child { min-width: 0; }
.pencil-admin .topbar > .top-actions {
  min-width: 0;
  max-width: none;
  width: auto;
  align-self: center;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.pencil-admin .topbar .scope-switch {
  min-width: 0;
  max-width: 280px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  white-space: nowrap;
  border: 0;
  padding: 0;
  background: transparent;
}
.pencil-admin .topbar #spaceScope { width: 160px; min-width: 0; max-width: 100%; }
.pencil-admin .topbar .locale-control { min-width: 0; }
.pencil-admin .topbar .locale-control select { min-width: 0; width: 110px; max-width: 100%; }
.pencil-admin .topbar #spaceScope,
.pencil-admin .topbar .locale-control select {
  min-height: 39px;
  height: 39px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.pencil-admin .topbar #userMenu { min-width: 0; max-width: 240px; }
.pencil-admin .topbar #userMenuTrigger { max-width: 100%; min-width: 0; }
.pencil-admin .topbar .user-avatar,
.pencil-admin .topbar .user-menu-chevron { flex: 0 0 auto; }
.pencil-admin .topbar .user-menu-copy { min-width: 0; flex: 1 1 auto; }
.pencil-admin .topbar .user-menu-copy strong,
.pencil-admin .topbar .user-menu-copy small {
  display: block;
  min-width: 0;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pencil-admin .topbar #fullscreenBtn { flex: 0 0 auto; }
.pencil-admin .topbar #userMenuPopover {
  position: fixed;
  box-sizing: border-box;
  width: 244px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  right: auto;
}
.pencil-admin .topbar .user-menu-profile,
.pencil-admin .topbar .user-menu-item { min-width: 0; }
.pencil-admin .topbar .user-menu-profile strong,
.pencil-admin .topbar .user-menu-profile span,
.pencil-admin .topbar .user-menu-item > span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 1280px) {
  .pencil-admin .topbar { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .pencil-admin .topbar > .top-actions { width: 100%; justify-content: flex-start; }
  .pencil-admin .topbar .title { max-width: none; }
}
@media (max-width: 760px) {
  .pencil-admin .topbar > .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 10px;
    align-items: center;
  }
  .pencil-admin .topbar > .top-actions > .locale-control {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .pencil-admin .topbar > .top-actions > .scope-switch {
    grid-column: 1 / -1;
    max-width: none;
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .pencil-admin .topbar .locale-control select,
  .pencil-admin .topbar #spaceScope { width: 100%; max-width: none; }
  .pencil-admin .topbar #userMenu { grid-column: 1; max-width: none; }
  .pencil-admin .topbar #userMenuTrigger { width: 100%; }
  .pencil-admin .topbar .user-menu-copy strong,
  .pencil-admin .topbar .user-menu-copy small { max-width: none; }
  .pencil-admin .topbar #fullscreenBtn { grid-column: 2; width: 40px; justify-self: end; }
}
