.md-checkbox {
  font-family: var(--md-typography-family-body);
  font-size: var(--md-typography-size-16);
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  position: relative;
}

.md-checkbox:has(input[type='checkbox']:focus-visible) {
  outline: var(--md-size-3) var(--md-color-focus-outer) solid;
  outline-offset: var(--md-size-3);
  box-shadow: 0 0 0 var(--md-size-3) var(--md-color-focus-inner);   
  transition: box-shadow 150ms ease-in-out, outline 150ms ease-in-out;  
  border-radius: var(--md-radius-sm);
}

.md-checkbox__input {
  opacity: 0;
  position: absolute;
  left: 0;
}

.md-checkbox__label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.md-checkbox__label::before {
  background-color: var(--md-color-grey-white);
  border: 1px solid var(--md-color-border-primary);
  border-radius: var(--md-size-2);
  content: '';
  cursor: pointer;
  height: var(--md-size-20);
  width: var(--md-size-20);
  min-width: var(--md-size-20);
}

.md-checkbox__input:focus-visible + .md-checkbox__label::before{
  background-color: var(--md-color-cta-secondary-default);
}

.md-checkbox:hover .md-checkbox__label::before {
  background-color: var(--md-color-surface-primary-tinted);
}

.md-checkbox__input:focus-visible + .md-checkbox__label {
  outline: var(--md-size-3) var(--md-color-focus-outer) solid;
  outline-offset: var(--md-size-3);
  box-shadow: 0 0 0 var(--md-size-3) var(--md-color-focus-inner);   
  transition: box-shadow 150ms ease-in-out, outline 150ms ease-in-out;
  
  border-radius: var(--md-radius-sm);
}

.md-checkbox__input:checked + .md-checkbox__label::before {
  background-image: url(data:image/svg+xml;base64,PHN2ZyBpZD0iZTk2NWRkN2EtN2NlNS00MTc0LThjMjEtY2UwNjIzYmFmNTJhIiBkYXRhLW5hbWU9ImNoZWNrbWFyay1ncmVlbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTMgMTAuMDIiPjx0aXRsZT5jaGVja21hcmstZ3JlZW48L3RpdGxlPjxwYXRoIGQ9Ik0xMS4xNCwwLDQuODMsNi4zMWwtMy0zTDAsNS4xOSw0LjgzLDEwLDEzLDEuODZaIiBmaWxsPSIjMDA2MTVjIiAvPjwvc3ZnPg==);
  background-repeat: no-repeat;
  background-position-y: var(--md-size-3);
  background-position-x: var(--md-size-1);
  background-size: 1rem;
  border-color: var(--md-color-border-tertiary);
}

.md-checkbox__input:indeterminate + .md-checkbox__label::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 3'%3E%3Crect x='1' y='0.5' width='11' height='2' rx='0.5' fill='%2300615c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.75rem;
}

.md-checkbox--disabled .md-checkbox__label::before,
.md-checkbox--disabled .md-checkbox__input:focus-visible + .md-checkbox__label::before,
.md-checkbox--disabled:hover .md-checkbox__label::before {
  background-color: var(--md-color-disabled-bg);
  border-color: var(--md-color-disabled-default);
  cursor: default;
}

.md-checkbox--disabled .md-checkbox__input:checked + .md-checkbox__label::before {
  background-image: url(data:image/svg+xml;base64,PHN2ZyBpZD0iZTk2NWRkN2EtN2NlNS00MTc0LThjMjEtY2UwNjIzYmFmNTJhIiBkYXRhLW5hbWU9ImNoZWNrbWFyay1ncmVlbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTMgMTAuMDIiPjx0aXRsZT5jaGVja21hcmstZ3JlZW48L3RpdGxlPjxwYXRoIGQ9Ik0xMS4xNCwwLDQuODMsNi4zMWwtMy0zTDAsNS4xOSw0LjgzLDEwLDEzLDEuODZaIiBmaWxsPSIjODA4MDgwIiAvPjwvc3ZnPg==);
}

.md-checkbox--disabled .md-checkbox__labelText,
.md-checkbox--disabled .md-checkbox__label {
  cursor: default;
}

.md-checkbox__labelText {
  font-size: var(--md-typography-size-16);
  left: var(--md-size-8);
  position: relative;
  padding-right: var(--md-size-8);
  color: var(--md-color-text-primary);
}

.md-checkbox:not(.md-checkbox--disabled):hover .md-checkbox__labelText {
  text-decoration: underline;
}
