/* 自定义样式 */
.app-sidebar {
    --sidebar-item-radius: 10px;
    --sidebar-subitem-radius: 8px;
    --sidebar-item-x: 12px;
    --sidebar-item-y: 10px;
    --sidebar-subitem-y: 8px;
    --sidebar-item-gap: 12px;
    --sidebar-color-default: var(--tblr-secondary-color);
    --sidebar-color-hover: var(--tblr-body-color);
    --sidebar-color-active: var(--tblr-primary);
    --sidebar-bg-hover: var(--tblr-gray-100);
    --sidebar-bg-active: var(--tblr-primary-bg-subtle);
    border-right: 1px solid var(--tblr-border-color);
}

.app-sidebar__brand {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1.25rem 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.app-sidebar__brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.app-sidebar__brand-link:hover,
.app-sidebar__brand-link:focus-visible {
    text-decoration: none;
}

.app-sidebar__brand-badge {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: var(--tblr-primary);
    color: var(--tblr-white);
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(var(--tblr-primary-rgb), 0.18);
    flex-shrink: 0;
}

.app-sidebar__brand-text {
    color: var(--tblr-heading-color);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.app-sidebar__nav {
    gap: 0.25rem;
    padding-bottom: 1rem;
}

.app-sidebar__link {
    margin: 0 var(--sidebar-item-x);
    padding: var(--sidebar-item-y) 1rem;
    border-radius: var(--sidebar-item-radius);
    color: var(--sidebar-color-default);
    display: flex;
    align-items: center;
    gap: var(--sidebar-item-gap);
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.app-sidebar__link .nav-link-icon {
    margin-right: 0;
    color: inherit;
}

.app-sidebar__link .icon {
    width: 20px;
    height: 20px;
    stroke-width: 1.9;
}

.app-sidebar__link .nav-link-title {
    font-weight: 500;
}

.app-sidebar__link:hover,
.app-sidebar__link:focus-visible {
    background-color: var(--sidebar-bg-hover);
    color: var(--sidebar-color-hover);
    text-decoration: none;
    outline: none;
}

.app-sidebar__link:focus-visible,
.app-sidebar__sublink:focus-visible {
    box-shadow: 0 0 0 2px rgba(var(--tblr-primary-rgb), 0.14);
}

.app-sidebar__link.dropdown-toggle::after {
    margin-left: auto;
    opacity: 0.55;
}

.app-sidebar__item.active:not(.dropdown) > .app-sidebar__link {
    background-color: var(--sidebar-bg-active);
    color: var(--sidebar-color-active);
}

.app-sidebar__item.active > .app-sidebar__link .nav-link-title {
    font-weight: 600;
}

.app-sidebar__item.dropdown.active > .app-sidebar__link {
    background-color: rgba(var(--tblr-primary-rgb), 0.05);
    color: var(--sidebar-color-hover);
}

.app-sidebar__submenu {
    position: static;
    float: none;
    display: none;
    min-width: 0;
    padding: 0 0 0.4rem;
    margin: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.app-sidebar__submenu.show {
    display: block;
}

.app-sidebar__sublink {
    margin: 0.25rem 0.75rem 0 1.5rem;
    padding: var(--sidebar-subitem-y) 1rem;
    border-radius: var(--sidebar-subitem-radius);
    color: var(--sidebar-color-default);
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.app-sidebar__sublink:hover,
.app-sidebar__sublink:focus-visible {
    background-color: var(--sidebar-bg-hover);
    color: var(--sidebar-color-hover);
    text-decoration: none;
    outline: none;
}

.app-sidebar__sublink.active,
.app-sidebar__sublink[aria-current="page"] {
    background-color: var(--sidebar-bg-active);
    color: var(--sidebar-color-active);
    font-weight: 600;
}

.app-sidebar .dropdown-menu .dropdown-item.active::before {
    display: none;
}

@media (max-width: 768px) {
    .app-sidebar {
        --sidebar-item-x: 8px;
    }

    .app-sidebar__brand-badge {
        display: none;
    }

    .app-sidebar__brand {
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: none;
        padding: 0.75rem 0 0.5rem;
        margin: 0;
    }

    .app-sidebar__brand-text {
        font-size: 1rem;
    }

    .app-sidebar__link,
    .app-sidebar__sublink {
        min-height: 44px;
    }

    .app-sidebar__sublink {
        margin-left: 1rem;
        margin-right: 0.5rem;
    }
}

/* Reusable styles for Markdown/Toast UI */

.md-editor-theme .toastui-editor-defaultUI {
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
}

.md-editor-theme .toastui-editor-toolbar {
    background: var(--tblr-bg-surface-secondary);
    border-bottom: 1px solid var(--tblr-border-color);
}

.md-editor-theme .toastui-editor-toolbar-icons {
    border-color: var(--tblr-border-color);
}

.md-editor-theme .toastui-editor-main {
    background: var(--tblr-bg-surface);
}

.md-editor-theme .toastui-editor-ww-container,
.md-editor-theme .toastui-editor-md-container {
    background: var(--tblr-bg-surface);
}

.md-editor-theme .toastui-editor-md-container .toastui-editor,
.md-editor-theme .toastui-editor-ww-container .toastui-editor-contents,
.md-editor-theme .toastui-editor-md-preview .toastui-editor-contents {
    font-family: var(--tblr-font-sans-serif);
    color: var(--tblr-body-color);
}

.md-editor-theme .toastui-editor-md-tab-container {
    background: var(--tblr-bg-surface-secondary);
    border-top: 1px solid var(--tblr-border-color);
}

.md-editor-theme .tab-item {
    color: var(--tblr-secondary-color);
}

.md-editor-theme .tab-item.active {
    color: var(--tblr-primary);
    font-weight: 600;
}

.md-editor-theme .ProseMirror {
    padding: .6rem 1.2rem;
}

.md-editor-theme .toastui-editor-contents code {
    background: var(--tblr-bg-surface-secondary);
}

.md-editor-theme .toastui-editor-contents pre {
    border: 1px solid var(--tblr-border-color);
    background: var(--tblr-bg-surface-secondary);
}

.md-editor-theme .toastui-editor-popup {
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
}

.md-content-theme {
    font-size: .875rem;
    line-height: 1.65;
    color: var(--tblr-body-color);
}

.md-content-theme .toastui-editor-contents,
.md-content-theme {
    font-family: var(--tblr-font-sans-serif);
}

.md-content-theme h1,
.md-content-theme h2,
.md-content-theme h3,
.md-content-theme h4,
.md-content-theme h5,
.md-content-theme h6,
.md-content-theme .toastui-editor-contents h1,
.md-content-theme .toastui-editor-contents h2,
.md-content-theme .toastui-editor-contents h3,
.md-content-theme .toastui-editor-contents h4,
.md-content-theme .toastui-editor-contents h5,
.md-content-theme .toastui-editor-contents h6,
.md-editor-theme .ProseMirror h1,
.md-editor-theme .ProseMirror h2,
.md-editor-theme .ProseMirror h3,
.md-editor-theme .ProseMirror h4,
.md-editor-theme .ProseMirror h5,
.md-editor-theme .ProseMirror h6,
.md-editor-theme .toastui-editor-md-preview h1,
.md-editor-theme .toastui-editor-md-preview h2,
.md-editor-theme .toastui-editor-md-preview h3,
.md-editor-theme .toastui-editor-md-preview h4,
.md-editor-theme .toastui-editor-md-preview h5,
.md-editor-theme .toastui-editor-md-preview h6 {
    color: var(--tblr-heading-color);
    font-family: var(--tblr-font-sans-serif);
    font-weight: 600 !important;
    line-height: 1.35 !important;
    margin-top: 1rem !important;
    margin-bottom: .5rem !important;
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.md-content-theme h1,
.md-content-theme .toastui-editor-contents h1,
.md-editor-theme .ProseMirror h1,
.md-editor-theme .toastui-editor-md-preview h1 {
    font-size: 1.35rem !important;
}

.md-content-theme h2,
.md-content-theme .toastui-editor-contents h2,
.md-editor-theme .ProseMirror h2,
.md-editor-theme .toastui-editor-md-preview h2 {
    font-size: 1.2rem !important;
}

.md-content-theme h3,
.md-content-theme .toastui-editor-contents h3,
.md-editor-theme .ProseMirror h3,
.md-editor-theme .toastui-editor-md-preview h3 {
    font-size: 1.05rem !important;
}

.md-content-theme h4,
.md-content-theme .toastui-editor-contents h4,
.md-editor-theme .ProseMirror h4,
.md-editor-theme .toastui-editor-md-preview h4 {
    font-size: .95rem !important;
}

.md-content-theme .toastui-editor-contents p,
.md-content-theme .toastui-editor-contents ul,
.md-content-theme .toastui-editor-contents ol,
.md-content-theme .toastui-editor-contents table,
.md-content-theme .toastui-editor-contents blockquote {
    margin-bottom: .3rem;
}

.md-content-theme .toastui-editor-contents a {
    color: var(--tblr-primary);
    text-decoration: underline;
}

.md-content-theme .toastui-editor-contents code {
    font-size: .8rem;
    padding: .1rem .35rem;
    border-radius: .25rem;
    background: var(--tblr-bg-surface-secondary);
}

.md-content-theme .toastui-editor-contents pre {
    padding: .65rem;
    border-radius: .35rem;
    background: var(--tblr-bg-surface-secondary);
    border: 1px solid var(--tblr-border-color);
}

.md-content-theme .toastui-editor-contents blockquote {
    padding: .5rem .75rem;
    border-left: .2rem solid var(--tblr-primary);
    background: var(--tblr-bg-surface-secondary);
    color: var(--tblr-secondary-color);
}

.md-content-theme .toastui-editor-contents table {
    width: 100%;
    border-collapse: collapse;
}

.md-content-theme .toastui-editor-contents th,
.md-content-theme .toastui-editor-contents td {
    border: 1px solid var(--tblr-border-color);
    padding: .35rem .5rem;
}

.toastui-editor-defaultUI-toolbar {
    padding: 0 0.6rem;
}
