.custom-toc {
    position: relative;
    margin: 1.25em 0 0 0;
    font-family: "Sharp Sans", sans-serif;
}
.custom-toc__label {
    position: absolute;
    top: 0;
    left: 24px;
    transform: translateY(-60%);
    background-color: #6FE6F1;
    border-radius: 0;
    color: #0C3644;
    font-family: "Sharp Sans", Arial, sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: normal;
    padding: 5px 10px;
    margin: 0;
    z-index: 2;
}
.custom-toc__box {
    background-color: transparent;
    border: 1px solid #C4C4C4;
    border-radius: 8px;
    padding: 2.5em 1.5em 1.5em 1.5em;
}

.custom-toc__box::after {
  content: "";
  position: sticky;
  bottom: 0;
  display: block;
  height: 28px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
}

.headings-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
}
.headings-list > li {
    position: relative;
    margin-bottom: 1em;
    padding-left: 1.5em;
    color: #383838;
}

.headings-list>li:last-child {
  margin-bottom: 0;
}

.headings-list > li::before {
    content: "";
    background-color: #F86200;
    border-radius: 50%;
    width: 8px;
    height: 8px;
    font-size: 24px;
    left: 0;
    line-height: 1;
    position: absolute;
    top: .375em;
}
.headings-list .toc-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.headings-list > li > .toc-item-wrapper > a {
    font-family: "Sharp Sans", sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 28px;
    text-decoration: none;
    color: #202326;
    transition: all 0.25s ease;
}
.headings-list > li > .toc-item-wrapper > a:hover,
.headings-list > li > .toc-item-wrapper > a.is-active {
    color: #FF7E0A;
    text-decoration: none;
    transition: all 0.25s ease;
}

/* Solo para teclado (accesible) */
.headings-list > li > .toc-item-wrapper > a:focus-visible {
  outline: 1px solid #FF7E0A;
}

.headings-list ul.toc-sublist {
    list-style: none;
    padding-left: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    will-change: max-height;
}
.headings-list ul.toc-sublist.expanded {
    max-height: 1000px;
}
.headings-list ul.toc-sublist > li {
    position: relative;
    margin: 0 0 0.75em 0;
    padding-left: 1.2em;
    color: #474747;
}

.headings-list ul.toc-sublist > li:first-child {
    margin-top: 0.5em;
}

.headings-list ul.toc-sublist > li:last-child {
    margin-bottom: 0.5em;
}

.headings-list ul.toc-sublist > li > p {
    margin: 0;
}
.headings-list ul.toc-sublist > li::before {
    content: "-";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 14px;
    line-height: 1;
    color: #585757;
}
.headings-list ul.toc-sublist a {
    font-size: 14px;
    line-height: normal;
    font-weight: 500;
    text-decoration: none;
    color: #585757;
    transition: all 0.25s ease;
}
.headings-list ul.toc-sublist a:hover,
.headings-list ul.toc-sublist a.is-active {
    color: #FF7E0A;
    text-decoration: none;
    transition: all 0.25s ease;
}

.headings-list ul.toc-sublist a:focus-visible {
  outline: 2px solid #FF7E0A;
}

/* Caret SVG - bigger tap target */
.toc-caret {
  /* tamaño visual del icono */
  width: 13px;
  height: 8px;

  /* hit area */
  min-width: 40px;
  min-height: 28px;
  padding: 0 12px;              /* ajusta si quieres más/menos */
  box-sizing: border-box;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  vertical-align: middle;
  cursor: pointer;
  flex: 0 0 auto;

  /* el SVG rota, no el contenedor */
  transform: none;
  transition: none;

  /* opcional: mejora de UX */
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Rotación del icono (aplicarla al path o al propio svg interno) */
.toc-caret path {
  fill: currentColor;
  transition: transform .2s ease;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.toc-caret:focus-visible {
  outline: 2px solid #FF7E0A;
  outline-offset: 2px;
}

/* Estado abierto: rota hacia abajo */
.headings-list li.dropdown-toggle.active .toc-caret path{
  transform: rotate(0deg);
}

.headings-list li.dropdown-toggle .toggle-icon {
    display: inline-block;
    margin-left: 10px;
    width: 1em;
    text-align: center;
    font-size: 18px;
    line-height: 1;
    color: #383838;
}

/* H4 debajo de H3 */
.headings-list ul.toc-subsublist {
  list-style: none;
  padding-left: 12px;   /* más indent que H3 */
  margin: 8px 0 0;
}

.headings-list ul.toc-subsublist > li {
  position: relative;
  margin: 0 0 8px 0;
  padding-left: 12px;
}

.headings-list ul.toc-subsublist > li:last-child {
  margin-bottom: 0;
}

.headings-list ul.toc-subsublist > li::before {
  content: "-";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 14px;
  line-height: 1;
  color: #585757;
}

.headings-list ul.toc-subsublist a {
  font-size: 13px;
  line-height: normal;
  font-weight: 500;
  text-decoration: none;
  color: #585757;
  transition: all 0.25s ease;
}
.headings-list ul.toc-subsublist a:hover,
.headings-list ul.toc-subsublist a.is-active {
  color: #FF7E0A;
  text-decoration: none;
}

@media (min-width: 1025px) {
  .custom-toc__box {
    max-height: calc(100vh - 125px - 24px); /* 125 = top sticky del wrapper */
    overflow-y: auto;
    overscroll-behavior: auto;
}

@media (max-width: 768px) {
    .custom-toc__label {
        font-size: 18px;
        line-height: 22px;
    } 

    .headings-list > li > .toc-item-wrapper > a {
        font-size: 16px;
        line-height: 22px;
    }

    .headings-list ul.toc-sublist a {
        font-size: 14px;
        line-height: 18px;
    }
}