/* kostnix Inhaltsverzeichnis – bewusst schlank und CLS-stabil */
.knw-toc {
  --knw-toc-header-bg: #f1f5f9;
  --knw-toc-panel-bg: #ffffff;
  --knw-toc-header-padding-y: 12px;
  --knw-toc-header-padding-x: 16px;
  --knw-toc-panel-padding-y: 14px;
  --knw-toc-panel-padding-x: 18px;
  --knw-toc-title-font-size: 16px;
  --knw-toc-link-font-size: 15px;
  --knw-toc-sticky-offset: 120px;
  --knw-toc-mobile-bottom: 16px;
  --knw-toc-mobile-panel-max-height: 55vh;
  --knw-toc-margin-open-top: 0px;
  --knw-toc-margin-open-bottom: 0px;
  --knw-toc-margin-closed-top: 0px;
  --knw-toc-margin-closed-bottom: 0px;
  box-sizing: border-box;
  margin: var(--knw-toc-margin-open-top) auto var(--knw-toc-margin-open-bottom) auto;
  padding: 0;
  border: 1px solid #d8dee6;
  border-radius: 10px;
  background: var(--knw-toc-panel-bg);
  color: #1f2937;
  overflow: hidden;
}

.knw-toc.is-closed {
  margin-top: var(--knw-toc-margin-closed-top);
  margin-bottom: var(--knw-toc-margin-closed-bottom);
}

.knw-toc.is-open {
  margin-top: var(--knw-toc-margin-open-top);
  margin-bottom: var(--knw-toc-margin-open-bottom);
}

.knw-toc *,
.knw-toc-sticky * {
  box-sizing: border-box;
}

.knw-toc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 0;
  padding: var(--knw-toc-header-padding-y) var(--knw-toc-header-padding-x);
  background: var(--knw-toc-header-bg);
}

.knw-toc__title {
  font-weight: 700;
  font-size: var(--knw-toc-title-font-size);
  line-height: 1.35;
}

.knw-toc__toggle,
.knw-toc-sticky__toggle {
  cursor: pointer;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #1f2937;
  font: inherit;
  line-height: 1.2;
}

.knw-toc__toggle {
  padding: .35rem .7rem;
  font-size: .9rem;
}

.knw-toc__panel {
  padding: var(--knw-toc-panel-padding-y) var(--knw-toc-panel-padding-x);
  background: var(--knw-toc-panel-bg);
}

.knw-toc__panel[hidden],
.knw-toc-sticky__panel[hidden] {
  display: none !important;
}

.knw-toc__list,
.knw-toc__sublist {
  margin: 0;
  padding-left: 1.25rem;
}

.knw-toc__sublist {
  margin-top: .26rem;
}

.knw-toc--plain .knw-toc__list,
.knw-toc--plain .knw-toc__sublist {
  list-style: disc;
}

.knw-toc--numbered .knw-toc__list,
.knw-toc--numbered .knw-toc__sublist {
  list-style: none;
  padding-left: 0;
}

.knw-toc--numbered .knw-toc__list {
  counter-reset: knw-toc-h2;
}

.knw-toc--numbered .knw-toc__item--h2 {
  counter-increment: knw-toc-h2;
  counter-reset: knw-toc-h3;
}

.knw-toc--numbered .knw-toc__item--h3 {
  counter-increment: knw-toc-h3;
}

.knw-toc--numbered .knw-toc__item--h2 > .knw-toc__link::before {
  content: counter(knw-toc-h2) ". ";
}

.knw-toc--numbered .knw-toc__item--h3 > .knw-toc__link::before {
  content: counter(knw-toc-h2) "." counter(knw-toc-h3) " ";
}

.knw-toc--numbered .knw-toc__item--orphan > .knw-toc__link::before {
  content: "";
}

.knw-toc__item {
  margin: .32rem 0;
  line-height: 1.45;
  font-size: var(--knw-toc-link-font-size);
}

.knw-toc__item--h3 {
  margin-left: 1rem;
  font-size: calc(var(--knw-toc-link-font-size) - 1px);
}

.knw-toc__link,
.knw-toc-sticky__link {
  color: inherit;
  text-decoration: none;
}

.knw-toc__link:hover,
.knw-toc__link:focus,
.knw-toc-sticky__link:hover,
.knw-toc-sticky__link:focus {
  text-decoration: underline;
}

.knw-toc-sticky {
  --knw-toc-header-bg: #f1f5f9;
  --knw-toc-panel-bg: #ffffff;
  --knw-toc-header-padding-y: 12px;
  --knw-toc-header-padding-x: 16px;
  --knw-toc-panel-padding-y: 14px;
  --knw-toc-panel-padding-x: 18px;
  --knw-toc-title-font-size: 16px;
  --knw-toc-link-font-size: 15px;
  --knw-toc-sticky-offset: 120px;
  --knw-toc-mobile-bottom: 16px;
  --knw-toc-mobile-panel-max-height: 55vh;
  position: fixed;
  top: var(--knw-toc-sticky-offset);
  z-index: 9999;
  width: 290px;
  max-width: calc(100vw - 32px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .16s ease, transform .16s ease;
}

.knw-toc-sticky.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.knw-toc-sticky--right {
  right: 24px;
}

.knw-toc-sticky--left {
  left: 24px;
}

.knw-toc-sticky__toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .85rem;
  max-width: 100%;
  background: var(--knw-toc-header-bg);
  font-size: var(--knw-toc-title-font-size);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .14);
}

.knw-toc-sticky__toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.knw-toc-sticky__panel {
  margin-top: .55rem;
  padding: var(--knw-toc-panel-padding-y) var(--knw-toc-panel-padding-x);
  border: 1px solid #d8dee6;
  border-radius: 10px;
  background: var(--knw-toc-panel-bg);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
  max-height: calc(100vh - var(--knw-toc-sticky-offset) - 24px);
  overflow: auto;
}

.knw-toc-sticky__list,
.knw-toc-sticky__sublist {
  margin: 0;
  padding-left: 1.15rem;
}

.knw-toc-sticky__sublist {
  margin-top: .22rem;
}

.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__list,
.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__sublist {
  list-style: none;
  padding-left: 0;
}

.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__list {
  counter-reset: knw-toc-sticky-h2;
}

.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__item--h2 {
  counter-increment: knw-toc-sticky-h2;
  counter-reset: knw-toc-sticky-h3;
}

.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__item--h3 {
  counter-increment: knw-toc-sticky-h3;
}

.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__item--h2 > .knw-toc-sticky__link::before {
  content: counter(knw-toc-sticky-h2) ". ";
}

.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__item--h3 > .knw-toc-sticky__link::before {
  content: counter(knw-toc-sticky-h2) "." counter(knw-toc-sticky-h3) " ";
}

.knw-toc-sticky.knw-toc--numbered .knw-toc-sticky__item--orphan > .knw-toc-sticky__link::before {
  content: "";
}

.knw-toc-sticky__item {
  margin: .28rem 0;
  line-height: 1.35;
  font-size: calc(var(--knw-toc-link-font-size) - 1px);
}

.knw-toc-sticky__item--h3 {
  margin-left: .85rem;
  font-size: calc(var(--knw-toc-link-font-size) - 2px);
}

/* Divi-Header berücksichtigen: Sprungziele nicht unter feste Header schieben */
h2[id],
h3[id],
.pac-dtocm-include h2[id],
.pac-dtocm-include h3[id] {
  scroll-margin-top: 120px;
}

@media (max-width: 980px) {
  .knw-toc-sticky[data-mobile-enabled="0"] {
    display: none !important;
  }

  .knw-toc-sticky {
    left: 16px;
    right: 16px;
    width: auto;
    max-width: calc(100vw - 32px);
  }

  .knw-toc-sticky[data-mobile-position="bottom"] {
    top: auto;
    bottom: var(--knw-toc-mobile-bottom);
  }

  .knw-toc-sticky[data-mobile-position="top"] {
    top: var(--knw-toc-sticky-offset);
    bottom: auto;
  }

  .knw-toc-sticky__panel {
    max-height: var(--knw-toc-mobile-panel-max-height);
  }
}
