.ko-smart-sidebar{display:flex;flex-direction:column;gap:16px;width:100%;max-width:100%;box-sizing:border-box;font-family:Inter,Arial,sans-serif;color:#222722}
.ko-smart-sidebar *{box-sizing:border-box}
.ko-side-card{background:#F6F3EA;border:1px solid #e4e7dc;border-radius:12px;padding:20px 18px;overflow:hidden}
.ko-side-title{font-family:Inter,Arial,sans-serif!important;font-weight:700!important;font-size:17px!important;line-height:1.35!important;letter-spacing:0!important;color:#014524!important;margin:0 0 12px!important}
.ko-side-list,.ko-related-list{list-style:none!important;margin:0!important;padding:0!important}
.ko-side-list{counter-reset:ko-entry}
.ko-side-list li{counter-increment:ko-entry;display:flex;gap:10px;align-items:baseline;padding:8px 0;border-bottom:1px solid #d9e1d7}
.ko-side-list li:last-child,.ko-related-list li:last-child{border-bottom:0}
.ko-side-list li:before{content:counter(ko-entry) '.';flex:0 0 auto;font-size:12px;font-weight:700;color:#D56204}
.ko-side-list a,.ko-related-list a{font-size:13px!important;line-height:1.5!important;color:#014524!important;text-decoration:none!important;overflow-wrap:anywhere;transition:color .2s}
.ko-side-list a:hover,.ko-related-list a:hover,.ko-side-list a.ko-current{color:#D56204!important;text-decoration:underline!important;text-underline-offset:3px}
.ko-related-card{background:#fff;border-color:#dce8df}
.ko-related-list li{padding:11px 0;border-bottom:1px solid #e9eee9}
.ko-related-list a{display:flex;justify-content:space-between;gap:10px;align-items:center;font-weight:600!important}
.ko-link-arrow{color:#D56204;flex-shrink:0;font-size:16px}
.ko-side-navigation[hidden]{display:none!important}
.wp-block-post-content h2[id]{scroll-margin-top:110px}
/* v2.4: keep both panels visible; scroll each list independently when needed. */
@media (min-width:782px) {
  .wp-block-column.ko-sidebar-column {
    position:sticky!important;
    top:var(--ko-sticky-top,16px)!important;
    align-self:flex-start!important;
    height:max-content!important;
    overflow:visible!important;
    min-width:0;
  }
  .wp-block-column.ko-sidebar-column .ko-smart-sidebar {
    max-height:calc(100vh - var(--ko-sticky-top,16px) - 16px)!important;
    max-height:calc(100dvh - var(--ko-sticky-top,16px) - 16px)!important;
    overflow:hidden!important;
    min-height:0;
  }
  /* Titles stay visible while each link list scrolls independently. */
  .ko-smart-sidebar > .ko-side-card {
    display:flex;
    flex-direction:column;
    flex:0 1 auto;
    min-height:0;
    overflow:hidden;
  }
  .ko-smart-sidebar > .ko-side-navigation { min-height: min(130px, 32dvh); }
  .ko-smart-sidebar > .ko-related-card { min-height: min(110px, 28dvh); }
  .ko-smart-sidebar .ko-side-title { flex:0 0 auto; }
  .ko-smart-sidebar .ko-side-list,
  .ko-smart-sidebar .ko-related-list {
    flex:0 1 auto;
    min-height:0;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior-y:contain;
    scrollbar-width:thin;
    scrollbar-color:#8eaa95 #f6f3ea;
    padding-right:7px!important;
  }
  .ko-smart-sidebar .ko-related-list { scrollbar-color:#8eaa95 #fff; }
  .ko-smart-sidebar .ko-side-list::-webkit-scrollbar,
  .ko-smart-sidebar .ko-related-list::-webkit-scrollbar { width:7px; }
  .ko-smart-sidebar .ko-side-list::-webkit-scrollbar-track { background:#f6f3ea;border-radius:8px; }
  .ko-smart-sidebar .ko-related-list::-webkit-scrollbar-track { background:#fff;border-radius:8px; }
  .ko-smart-sidebar .ko-side-list::-webkit-scrollbar-thumb,
  .ko-smart-sidebar .ko-related-list::-webkit-scrollbar-thumb { background:#8eaa95;border-radius:8px; }
}
@media (max-width:781px) {
  .wp-block-column.ko-sidebar-column {position:static!important;top:auto!important;}
  .ko-smart-sidebar {max-height:none!important;overflow:visible!important;}
  .ko-side-card {padding:16px;}
  .ko-side-list,.ko-related-list {max-height:none;overflow:visible;}
}

/* v2.5: mobile TOC accordion; desktop remains expanded and sticky. */
.ko-side-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #014524;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  opacity: 1;
}
.ko-side-toggle:disabled { color: #014524; opacity: 1; cursor: default; }
.ko-side-toggle:focus-visible { outline: 2px solid #D56204; outline-offset: 4px; }
@media (max-width:781px) {
  .ko-smart-sidebar { gap: 0 !important; width: 100%; max-width: 100%; }
  .ko-smart-sidebar > .ko-related-card { display: none !important; }
  .ko-smart-sidebar > .ko-side-navigation {
    padding: 0 !important;
    margin: 0 !important;
    background: #F6F3EA;
    border: 1px solid #DCE8DF;
    border-radius: 12px;
    overflow: hidden;
  }
  .ko-smart-sidebar .ko-side-navigation > .ko-side-title {
    margin: 0 !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
  }
  .ko-smart-sidebar .ko-side-toggle {
    cursor: pointer;
    min-height: 48px;
    padding: 13px 16px;
  }
  .ko-smart-sidebar .ko-side-toggle::after {
    content: '';
    display: block;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #D56204;
    border-bottom: 2px solid #D56204;
    transform: rotate(45deg);
    transition: transform .2s ease;
    margin-right: 3px;
  }
  .ko-smart-sidebar .ko-side-toggle[aria-expanded='true']::after {
    transform: rotate(225deg);
  }
  .ko-smart-sidebar .ko-side-list {
    max-height: min(340px, 48svh);
    padding: 0 16px 12px !important;
    margin: 0 !important;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .ko-smart-sidebar .ko-side-list[hidden] { display: none !important; }
  .ko-smart-sidebar .ko-side-list li { padding: 9px 0; }
  .ko-smart-sidebar .ko-side-list a { font-size: 12.5px !important; }
}
@media (prefers-reduced-motion:reduce) {
  .ko-smart-sidebar .ko-side-toggle::after { transition: none; }
}
