#toc {
  padding: 0.5rem;
  background: transparent;
  /* will be set to sticky via JS with top equal to header height */
  position: sticky;
  z-index: 20;
  scrollbar-color: #aaa #ccc;
}
#toc b {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 700;
}
.toc-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.toc-item {
  margin: 0.15rem 0;
}
.toc-item a {
  display: block;
  color: #333;
  text-decoration: none;
  padding: 0.25rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.2s, color 0.2s;
}
.toc-item a:hover {
  background: rgba(75, 83, 32, 0.1);
  color: #4b5320;
}
.toc-item a.active {
  font-weight: bold;
  color: #4b5320;
  background: rgba(75, 83, 32, 0.15);
}
.toc-h1 {
  padding-left: 0;
}
.toc-h2 {
  padding-left: 0.75rem;
  font-size: 0.95em;
}
.toc-h3 {
  padding-left: 1.5rem;
  font-size: 0.9em;
}
/* ensure toc scrolls when content is taller than container */
#toc {
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}
