.sg-toc {
    --sg-toc-accent: #f05555;
    color: #27292c;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 16px;
    padding: 21px 24px;
    margin: 0 0 20px;
    font-family: Poppins, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.48;
}
.sg-toc summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #27292c;
    font-size: 15px;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}
.sg-toc summary::-webkit-details-marker { display: none; }
.sg-toc-percent { color: #be2323; font-size: 12px; font-variant-numeric: tabular-nums; }
.sg-toc-body {
    max-height: min(53vh, 500px);
    overflow: auto;
    margin-top: 12px;
    border-top: 1px solid #e5e5e5;
    padding-top: 9px;
    scrollbar-width: thin;
}
.sg-toc ul { list-style: none; padding: 0; margin: 0; }
.sg-toc ul ul { padding-left: 16px; }
.sg-toc li { margin: 0; padding: 0; }
.sg-toc a {
    display: block;
    position: relative;
    color: #595e64;
    text-decoration: none;
    padding: 6px 4px 6px 15px;
    overflow-wrap: anywhere;
}
.sg-toc a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 13px;
    width: 6px;
    height: 6px;
    border: 1px solid #989ca0;
    border-radius: 50%;
    box-sizing: border-box;
}
.sg-toc a:hover, .sg-toc a[aria-current] { color: #27292c; }
.sg-toc a[aria-current] { font-weight: 600; }
.sg-toc a[aria-current]::before { background: var(--sg-toc-accent); border-color: var(--sg-toc-accent); }
.sg-toc a:focus-visible, .sg-toc summary:focus-visible { outline: 2px solid #be2323; outline-offset: -2px; }
.sg-toc progress {
    display: block;
    width: 100%;
    height: 4px;
    margin-top: 10px;
    appearance: none;
    border: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #e5e5e5;
}
.sg-toc progress::-webkit-progress-bar { background: #e5e5e5; }
.sg-toc progress::-webkit-progress-value { background: var(--sg-toc-accent); }
.sg-toc progress::-moz-progress-bar { background: var(--sg-toc-accent); }
.sg-toc-target { scroll-margin-top: var(--sg-toc-offset, 88px); }

.sg-toc-slot {
    position: relative;
    margin-bottom: 20px;
}
.sg-toc-slot > .sg-toc {
    margin: 0;
}
.sg-toc-slot .sg-toc-body {
    max-height: min(53vh, 500px, max(100px, calc(100vh - var(--sg-toc-offset, 72px) - 112px)));
    overscroll-behavior-y: contain;
}

.sg-toc a:active,
.sg-toc a:focus,
.sg-toc a[aria-current="location"] {
    color: #27292c !important;
    -webkit-tap-highlight-color: transparent;
}
.sg-toc a { -webkit-tap-highlight-color: transparent; }
.sg-toc progress { accent-color: var(--sg-toc-accent); }

aside.sidebar .widget:has(.sg-toc-mount),
.sg-toc-mount {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
aside.sidebar .widget:has(.sg-toc-mount):not(:has(.sg-toc)),
aside.sidebar .widget:has(.sg-toc-mount) > p:empty {
    display: none;
}
.sg-toc-body { overflow-x: hidden; }
.sg-toc .sg-toc-body ul,
.sg-toc .sg-toc-body li { list-style: none !important; }
.sg-toc .sg-toc-body li::before,
.sg-toc .sg-toc-body li::after { content: none !important; }
.sg-toc .sg-toc-body a { white-space: normal !important; }
aside.sidebar :is(pre, code, blockquote, .textwidget):has(.sg-toc-mount) {
    display: block;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    white-space: normal !important;
    overflow: visible !important;
}

.sg-toc .sg-toc-body a { color: #595e64 !important; }
.sg-toc .sg-toc-body a[aria-current="location"] { color: #27292c !important; }

@media (max-width: 991px) {
    .entry-content .sg-toc .sg-toc-body ul {
        margin: 0 !important;
        padding: 0 !important;
    }
    .entry-content .sg-toc .sg-toc-body ul ul {
        padding-inline-start: 14px !important;
    }
    .entry-content .sg-toc .sg-toc-body li {
        margin-inline-start: 0 !important;
        padding-inline-start: 0 !important;
    }
}

@media (min-width: 992px) {
    aside.sidebar:has(.sg-toc-slot) {
        position: relative !important;
        top: auto !important;
        transform: none !important;
        transition: none !important;
        align-self: start;
        height: fit-content;
        min-height: 0 !important;
    }
    aside.sidebar:has(.sg-toc-slot) > .theiaStickySidebar {
        position: static !important;
        transform: none !important;
        width: auto !important;
        inset: auto !important;
    }
}

@media (min-width: 992px) {
    aside.sidebar.sg-toc-sidebar-fixed:has(.sg-toc-slot) {
        position: fixed !important;
        top: var(--sg-toc-rail-top) !important;
        left: var(--sg-toc-rail-left) !important;
        width: var(--sg-toc-rail-width) !important;
        box-sizing: border-box;
        margin: 0 !important;
        z-index: 5;
    }
    .sg-toc-sidebar-anchor {
        flex: 0 0 auto;
    }
}
