You can split the bookings for much better fares.
Stockholm to Copenhagen: ~2-400 SEK booked in advance.
Copenhagen to Freiburg overnight: €63.50 for a seat, €79-89 for couchettes, €124-194 for a cabin.
Alternatively, Copenhagen - Hamburg - Freiburg (change at Hamburg, train goes on the ferry): from €39.50.
These are all sample fares based on random dates next week.