What is margin in demat account

How is margin used or calculated in a demat account?