.checkbox input {
    left: 0;
    opacity: 0;
    position: absolute;
}

.checkbox input + label {
    display: inline-block;
    max-width: 100%;
    padding-left: 2em;
    position: relative;
}

.checkbox input + label::before,
.checkbox input + label::after {
    background: var(--background-secondary);
    box-sizing: border-box;
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    position: absolute;
    left: 0;
    vertical-align: top;
    text-align: center;
    transition: all 100ms ease;
}

.checkbox input + label::before {
    border: 1px solid var(--background-tertiary);
    border-radius: 2px;
    top: 2px;
}
.success input + label::before {
    border-color: var(--background-secondary);
    outline: 1px solid var(--color-success);
}
.warning input + label::before {
    border-color: var(--background-secondary);
    outline: 1px solid var(--color-warning);
}
.info input + label::before {
    border-color: var(--background-secondary);
    outline: 1px solid var(--color-info);
}

.checkbox input + label::after {
    background: transparent;
    border: solid var(--background-secondary);
    border-width: 0px 2px 2px 0;
    width: 0.35em;
    height: 0.55em;
    position: absolute;
    top: 6px;
    left: 6px;
    margin-left: -1px;
    margin-top: -2px;
    opacity: 0;
    transform: scale(2) rotate(45deg);
    transition: opacity .2s ease-out, transform .2s ease-out;
}

/* checked */

.checkbox input:checked + label::before {
    background-color: var(--color-blue);
    border-color: var(--color-blue);
}

.success input:checked + label::before {
    background-color: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-alt);
}

.warning input:checked + label::before {
    background-color: var(--color-warning);
    border-color: var(--color-warning);
    color: var(--color-alt);
}

.info input:checked + label::before {
    background-color: var(--color-info);
    border-color: var(--color-info);
    color: var(--color-alt);
}

.checkbox input:checked + label::after {
    opacity: 1;
    transform: scale(1) rotate(37deg);
}

/* focus */

.checkbox input[type="checkbox"]:focus + label::before {
    border-color: var(--color-blue);
    outline: none;
    outline-offset: 0;
}

.checkbox input[type="checkbox"]:checked:focus + label::before {
    outline: 2px solid var(--color-blue);
    outline-offset: -1px;
}

:is(.success, .warning, .info) input[type="checkbox"]:focus + label::before,
:is(.success, .warning, .info) input[type="checkbox"]:checked:focus + label::before {
    border-color: transparent;
    outline: 2px solid var(--color-blue);
    outline-offset: 0;
}

/* disabled */

.checkbox input[disabled] + label::before {
    background: rgb(248, 248, 248);
    border-color: rgb(220, 220, 220);
    cursor: not-allowed;
}
