.klitly-toc-card {
	margin: 2rem 0 2.5rem;
	background: #fff;
	border: 1px solid #ece8e1;
	border-radius: 18px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
	overflow: hidden;
}

.klitly-toc-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	background: transparent;
	border: 0;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: #1f2629;
	appearance: none;
	-webkit-appearance: none;
}

.klitly-toc-toggle:hover,
.klitly-toc-toggle:focus,
.klitly-toc-toggle:active {
	background: transparent;
	color: #1f2629;
	outline: none;
	box-shadow: none;
}

.klitly-toc-heading-wrap {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.klitly-toc-flag {
	font-size: 0.9rem;
	line-height: 1;
	transform: translateY(-0.02em);
	flex-shrink: 0;
}

.klitly-toc-title {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

.klitly-toc-toggle-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.1rem;
	height: 1.1rem;
	flex-shrink: 0;
	color: #6f787d;
	font-size: 0;
	position: relative;
}

.klitly-toc-toggle-label::before {
	content: "";
	width: 0.5rem;
	height: 0.5rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-135deg);
	position: absolute;
	top: 50%;
	left: 50%;
	margin-top: -0.17rem;
	margin-left: -0.25rem;
	transition: transform 0.18s ease;
}

.klitly-toc-card.is-collapsed .klitly-toc-toggle-label::before {
	transform: rotate(45deg);
	margin-top: -0.28rem;
}

.klitly-toc-body {
	border-top: 1px solid #f1ede7;
	padding: 0.85rem 1.25rem 1rem;
}

/* ---------- LIST ---------- */

.klitly-toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: toc-counter;
}

.klitly-toc-item {
	margin: 0;
	padding: 0;
}

/* Standard: kein zusätzlicher Abstand zwischen allen Punkten */
.klitly-toc-item + .klitly-toc-item {
	margin-top: 0;
}

/* Nur vor einem neuen H2-Hauptpunkt etwas Luft */
.klitly-toc-item.level-2 + .klitly-toc-item.level-2,
.klitly-toc-item.level-3 + .klitly-toc-item.level-2,
.klitly-toc-item.level-4 + .klitly-toc-item.level-2 {
	margin-top: 0.28rem;
}

/* ---------- H2 MIT NUMMER ---------- */

.klitly-toc-item.level-2 {
	counter-increment: toc-counter;
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	position: relative;
}

.klitly-toc-item.level-2::before {
	content: counter(toc-counter, decimal-leading-zero);
	font-size: 0.72rem;
	color: #a3adb2;
	min-width: 1.65rem;
	text-align: right;
	font-weight: 400;
	margin-top: 0.08rem;
	margin-left: -0.35rem;
}

.klitly-toc-item.level-2 .klitly-toc-link {
	font-weight: 600;
}

/* Nummern via Shortcode deaktivieren */
.klitly-toc-list.no-numbers .klitly-toc-item.level-2::before {
	display: none;
}

.klitly-toc-list.no-numbers .klitly-toc-item.level-2 {
	gap: 0;
}

/* ---------- LINKS ---------- */

.klitly-toc-link {
	display: inline-block;
	text-decoration: none !important;
	color: #1f2629 !important;
	font-size: 0.97rem;
	line-height: 1.45;
	border: 0;
	box-shadow: none;
	transition: color 0.16s ease;
}

.klitly-toc-link:link,
.klitly-toc-link:visited,
.klitly-toc-link:active {
	color: #1f2629 !important;
	text-decoration: none !important;
}

.klitly-toc-link:hover,
.klitly-toc-link:focus,
.klitly-toc-card a.klitly-toc-link:hover,
.klitly-toc-card .klitly-toc-link:hover,
.klitly-toc-card a.klitly-toc-link:focus,
.klitly-toc-card .klitly-toc-link:focus {
	color: #CD1531 !important;
	text-decoration: none !important;
	outline: none;
}

/* ---------- H3 / H4 ---------- */

.klitly-toc-item.level-3,
.klitly-toc-item.level-4 {
	position: relative;
}

.klitly-toc-item.level-3 {
	padding-left: 1.8rem;
}

.klitly-toc-item.level-4 {
	padding-left: 2.4rem;
}

.klitly-toc-item.level-3::before,
.klitly-toc-item.level-4::before {
	content: "";
	position: absolute;
	top: 0.45em;
	width: 0.55rem;
	height: 0.7em;
	border-left: 1px solid #e4ddd4;
}

.klitly-toc-item.level-3::before {
	left: 1.2rem;
}

.klitly-toc-item.level-4::before {
	left: 1.8rem;
}

.klitly-toc-item.level-3 .klitly-toc-link {
	font-size: 0.94rem;
	color: #526066 !important;
	font-weight: 400;
}

.klitly-toc-item.level-4 .klitly-toc-link {
	font-size: 0.92rem;
	color: #68757a !important;
	font-weight: 400;
}

.klitly-toc-item.level-3 .klitly-toc-link:hover,
.klitly-toc-item.level-3 .klitly-toc-link:focus,
.klitly-toc-item.level-4 .klitly-toc-link:hover,
.klitly-toc-item.level-4 .klitly-toc-link:focus {
	color: #CD1531 !important;
}

/* ---------- COLLAPSE ---------- */

.klitly-toc-card.is-collapsed .klitly-toc-body {
	display: none;
}

html {
	scroll-behavior: smooth;
}

/* ---------- MOBILE ---------- */

@media (max-width: 680px) {
	.klitly-toc-card {
		border-radius: 16px;
	}

	.klitly-toc-toggle {
		padding: 0.95rem 1rem;
	}

	.klitly-toc-body {
		padding: 0.75rem 1rem 0.95rem;
	}

	.klitly-toc-item.level-2 {
		gap: 0.5rem;
	}

	.klitly-toc-item.level-2::before {
		min-width: 1.45rem;
		margin-left: -0.25rem;
	}

	.klitly-toc-list.no-numbers .klitly-toc-item.level-2 {
		gap: 0;
	}

	.klitly-toc-item.level-3 {
		padding-left: 1.6rem;
	}

	.klitly-toc-item.level-4 {
		padding-left: 2.1rem;
	}

	.klitly-toc-item.level-3::before {
		left: 1.05rem;
	}

	.klitly-toc-item.level-4::before {
		left: 1.55rem;
	}

	.klitly-toc-item.level-2 + .klitly-toc-item.level-2,
	.klitly-toc-item.level-3 + .klitly-toc-item.level-2,
	.klitly-toc-item.level-4 + .klitly-toc-item.level-2 {
		margin-top: 0.24rem;
	}
}