.home-page {
    --tb-sidebar-width: 300px;
    --tb-sidebar-bg: #f8f7f4;
    --tb-sidebar-ink: #201f1d;
    --tb-sidebar-muted: #777773;
    --tb-sidebar-line: #e6e4df;
    --tb-sidebar-hover: #eeece8;
    --tb-sidebar-active: #e7e5e1;
    --tb-sidebar-field: #fff;
    padding-top: 0;
    padding-left: var(--tb-sidebar-width);
}

html[data-theme="dark"] .home-page {
    --tb-sidebar-bg: #090909;
    --tb-sidebar-ink: #f6f6f6;
    --tb-sidebar-muted: #999;
    --tb-sidebar-line: #252525;
    --tb-sidebar-hover: #191919;
    --tb-sidebar-active: #202020;
    --tb-sidebar-field: #0d0d0d;
}

.tb-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    width: var(--tb-sidebar-width);
    padding: 18px 14px 14px;
    border-right: 1px solid var(--tb-sidebar-line);
    background: var(--tb-sidebar-bg);
    color: var(--tb-sidebar-ink);
    color-scheme: light;
}

html[data-theme="dark"] .home-page .tb-sidebar { color-scheme: dark; }

.tb-sidebar__brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding: 0 4px;
}

.tb-sidebar__brand {
    display: inline-flex;
    align-items: center;
    color: var(--tb-sidebar-ink);
    text-decoration: none;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.04em;
}

.tb-sidebar__logo-crop {
    position: relative;
    display: block;
    flex: none;
    width: 130px;
    height: 32px;
    overflow: hidden;
}

.tb-sidebar__logo-crop img {
    position: absolute;
    top: 50%;
    left: -45px;
    display: block;
    width: 216px;
    max-width: none;
    height: auto;
    transform: translateY(-50%);
}

html[data-theme="dark"] .tb-sidebar__logo-crop img {
    filter: invert(1) hue-rotate(180deg);
}

.tb-sidebar__search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 45px;
    margin: 18px 2px 14px;
    padding: 0 11px;
    border: 1px solid var(--tb-sidebar-line);
    border-radius: 11px;
    background: var(--tb-sidebar-field);
    color: var(--tb-sidebar-muted);
    font: inherit;
    cursor: pointer;
}

.tb-sidebar__search-wrap:hover {
    border-color: var(--tb-sidebar-muted);
}

.tb-sidebar__search-wrap:focus-visible {
    outline: 2px solid var(--tb-sidebar-ink);
    outline-offset: 2px;
}

.tb-sidebar__search-wrap > i { font-size: 17px; }

.tb-sidebar__search-wrap span {
    min-width: 0;
    flex: 1;
    text-align: left;
    font-size: 14px;
}

.tb-sidebar__search-wrap kbd {
    flex: none;
    padding: 2px 5px;
    border: 1px solid var(--tb-sidebar-line);
    border-radius: 5px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.tb-sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.tb-sidebar__label {
    margin: 27px 12px 9px;
    color: var(--tb-sidebar-muted);
    font-size: 12px;
    font-weight: 700;
}

.tb-sidebar__item {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    min-height: 42px;
    margin: 2px 0;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--tb-sidebar-muted);
    font: 500 14px/1.2 Arial, sans-serif;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.tb-sidebar__item > i:first-child {
    flex: 0 0 18px;
    width: 18px;
    font-size: 17px;
    text-align: center;
}

.tb-sidebar__item:hover,
.tb-sidebar__item.is-active {
    background: var(--tb-sidebar-active);
    color: var(--tb-sidebar-ink);
}

.tb-sidebar__item:hover:not(.is-active) { background: var(--tb-sidebar-hover); }
.tb-sidebar__chevron { margin-left: auto; font-size: 12px; }

.tb-sidebar__category { display: flex; align-items: center; gap: 2px; }
.tb-sidebar__category .tb-sidebar__item { flex: 1; min-width: 0; width: auto; }
.tb-sidebar__expand {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tb-sidebar-muted);
    cursor: pointer;
}
.tb-sidebar__expand:hover { background: var(--tb-sidebar-hover); color: var(--tb-sidebar-ink); }
.tb-sidebar__expand i { font-size: 12px; transition: transform .18s ease; }
.tb-sidebar__expand[aria-expanded="true"] i { transform: rotate(90deg); }
.tb-sidebar__subnav { margin: 1px 0 8px 21px; padding-left: 10px; border-left: 1px solid var(--tb-sidebar-line); }
.tb-sidebar__subnav[hidden] { display: none; }
.tb-sidebar__tool {
    display: block;
    overflow: hidden;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--tb-sidebar-muted);
    font-size: 13px;
    line-height: 1.25;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tb-sidebar__tool:hover { background: var(--tb-sidebar-hover); color: var(--tb-sidebar-ink); }
.tb-sidebar__tool.is-active { background: var(--tb-sidebar-active); color: var(--tb-sidebar-ink); font-weight: 600; }

.tb-sidebar__footer {
    flex: none;
    padding-top: 10px;
    border-top: 1px solid var(--tb-sidebar-line);
}

.tb-sidebar__close,
.tb-mobile-bar { display: none; }

.tb-sidebar :is(a, button, input):focus-visible,
.tb-mobile-bar button:focus-visible {
    outline: 2px solid var(--tb-sidebar-ink);
    outline-offset: 2px;
}

.tb-sidebar-backdrop[hidden] { display: none; }

@media (max-width: 900px) {
    .home-page { padding-left: 0; padding-top: 56px; }

    .tb-mobile-bar {
        position: fixed;
        inset: 0 0 auto;
        z-index: 999;
        display: flex;
        align-items: center;
        gap: 10px;
        height: 56px;
        padding: 0 16px;
        border-bottom: 1px solid var(--tb-sidebar-line);
        background: var(--tb-sidebar-bg);
        color: var(--tb-sidebar-ink);
        font-size: 17px;
        font-weight: 700;
    }

    .tb-mobile-bar button,
    .tb-sidebar__close {
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--tb-sidebar-ink);
        font-size: 23px;
        cursor: pointer;
    }

    .tb-sidebar {
        width: min(300px, 88vw);
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .tb-sidebar.is-open { transform: translateX(0); }

    .tb-sidebar-backdrop:not([hidden]) {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: block;
        background: rgb(0 0 0 / .46);
    }

    .home-page.tb-sidebar-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .tb-sidebar { transition: none; }
}
