.checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text);
}

.checkbox__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.checkbox__box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.checkbox__input:checked + .checkbox__box {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.checkbox__input:focus-visible + .checkbox__box {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.checkbox__input:disabled + .checkbox__box {
  opacity: 0.5;
}

.checkbox:has(.checkbox__input:disabled) {
  cursor: not-allowed;
  opacity: 0.7;
}

.checkbox__check {
  display: block;
}

@media (pointer: coarse) {
  .checkbox {
    min-height: var(--tap);
  }
}
