.widget_expelys_toc,
.expelys-toc-widget {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem 1.2rem;
    background: #fafafa;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    max-height: 70vh;
    overflow-y: auto;
    max-width: 100%;
    scroll-padding-top: 80px;
}

.expelys-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.4rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.expelys-toc-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    color: #333;
    white-space: nowrap;
}

.expelys-toc-top-link {
    font-size: 0.85rem;
    color: #0073aa;
    text-decoration: none;
    white-space: nowrap;
}

.expelys-toc-top-link:hover,
.expelys-toc-top-link:focus {
    text-decoration: underline;
}

.expelys-toc-items-root {
    list-style: none;
    margin: 0.4rem 0 0 0;
    padding-left: 0;
}

.expelys-toc-item {
    margin: 0.3rem 0;
}

.expelys-toc-item a {
    color: #444;
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s ease;
}

.expelys-toc-item a:hover,
.expelys-toc-item a:focus {
    color: #0073aa;
    text-decoration: underline;
}

.expelys-toc-sub {
    list-style: none;
    margin: 0.2rem 0 0.2rem 1rem;
    padding-left: 0.8rem;
    border-left: 2px solid #eee;
}

.expelys-toc-sub .expelys-toc-item a {
    font-size: 0.9rem;
    color: #555;
}

.expelys-toc-item a.active-toc-item {
    color: #0073aa;
    font-weight: 600;
}

@media (max-width: 480px) {
    .expelys-toc-header {
        flex-direction: column;
        align-items: flex-start;
    }
}