.kb-page {
    padding-top: 96px;
}

.kb-index-hero {
    padding: 64px 0 32px;
}

.kb-index-hero h1 {
    color: var(--text, #1e293b);
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.12;
    margin-bottom: 16px;
}

.kb-index-hero p {
    color: var(--text-secondary, #64748b);
    font-size: 18px;
    max-width: 720px;
}

.kb-index-content {
    padding: 0 0 96px;
}

.kb-search {
    display: flex;
    max-width: 680px;
    margin-bottom: 40px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 16px);
    background: var(--card-bg, #fff);
    box-shadow: var(--card-shadow, 0 4px 24px rgba(15, 23, 42, 0.06));
    overflow: hidden;
}

.kb-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text, #1e293b);
    font: inherit;
    padding: 16px 18px;
}

.kb-search input:focus {
    outline: none;
}

.kb-search button {
    border: 0;
    background: var(--primary, #2563eb);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0 24px;
}

.kb-result-note,
.kb-empty {
    color: var(--text-secondary, #64748b);
    margin-bottom: 20px;
}

.kb-category {
    margin-bottom: 48px;
}

.kb-category h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text, #1e293b);
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 18px;
}

.kb-card-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.kb-article-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 132px;
    padding: 22px;
    color: var(--text, #1e293b);
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 16px);
    box-shadow: var(--card-shadow, 0 4px 24px rgba(15, 23, 42, 0.06));
    transition: transform var(--transition, 0.2s ease), box-shadow var(--transition, 0.2s ease), border-color var(--transition, 0.2s ease);
}

.kb-article-card:hover {
    color: var(--text, #1e293b);
    border-color: transparent;
    box-shadow: var(--card-shadow-hover, 0 12px 40px rgba(15, 23, 42, 0.12));
    transform: translateY(-3px);
}

.kb-article-card strong {
    font-size: 18px;
    line-height: 1.35;
}

.kb-article-card span {
    color: var(--text-secondary, #64748b);
    font-size: 15px;
    line-height: 1.55;
}

.kb-article-category {
    color: var(--primary, #2563eb) !important;
    font-family: var(--font-mono, monospace);
    font-size: 12px !important;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.kb-breadcrumbs {
    padding: 112px 0 0;
    color: var(--text-light, #94a3b8);
    font-size: 14px;
}

.kb-breadcrumbs .container {
    display: flex;
    gap: 8px;
}

.kb-breadcrumbs a {
    color: var(--text-secondary, #64748b);
}

.kb-article-shell {
    padding: 30px 0 96px;
}

.kb-article-layout {
    display: grid;
    grid-template-columns: minmax(218px, 250px) minmax(0, 760px);
    gap: 56px;
    align-items: start;
    max-width: 1120px;
}

.kb-toc {
    position: sticky;
    top: 104px;
    max-height: calc(100vh - 128px);
}

.kb-toc:empty,
.kb-toc.is-empty {
    display: none;
}

.kb-toc-inner {
    position: relative;
    padding: 6px 0 6px 14px;
    overflow: hidden;
    background: transparent;
    border-left: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.kb-toc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding: 0 2px 9px;
    border-bottom: 0;
}

.kb-toc-title {
    color: var(--text, #1e293b);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
}

.kb-toc-count {
    color: var(--text-light, #94a3b8);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
    margin-top: 2px;
}

.kb-toc nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 235px);
    overflow: auto;
    padding: 2px;
    scrollbar-width: thin;
}

.kb-toc a {
    position: relative;
    isolation: isolate;
    display: block;
    color: #475569;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    padding: 8px 10px 8px 27px;
    transition: color 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 160ms cubic-bezier(0.23, 1, 0.32, 1), transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.kb-toc a::after {
    content: "";
    position: absolute;
    inset: 3px 0 3px 22px;
    z-index: -1;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.085), rgba(37, 99, 235, 0));
    opacity: 0;
    transition: opacity 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.kb-toc a::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #cbd5e1;
    transform: translateY(-50%);
    transition: background-color 160ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.kb-toc a:hover,
.kb-toc a.is-active {
    color: #0f172a;
    background: transparent;
}

.kb-toc a.is-active {
    transform: translateX(2px);
    box-shadow: none;
}

.kb-toc a:hover::after,
.kb-toc a.is-active::after {
    opacity: 1;
}

.kb-toc a.is-active::before {
    background: var(--primary, #2563eb);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

.kb-toc a[data-level="3"] {
    padding-left: 39px;
    font-size: 13px;
    font-weight: 560;
}

.kb-toc a[data-level="3"]::before {
    left: 24px;
}

.kb-toc a[data-level="4"] {
    padding-left: 50px;
    font-size: 13px;
    font-weight: 520;
}

.kb-toc a[data-level="4"]::before {
    left: 35px;
}

.kb-article {
    min-width: 0;
}

.kb-article-lead {
    max-width: 70ch;
    color: #334155;
    font-size: 20px;
    font-weight: 520;
    line-height: 1.55;
    margin: -18px 0 36px;
}

.kb-article-header {
    max-width: 760px;
    margin-bottom: 42px;
}

.kb-article-header h1 {
    color: var(--text, #1e293b);
    font-size: clamp(32px, 4vw, 44px);
    font-weight: 760;
    line-height: 1.16;
    margin: 0 0 16px;
}

.kb-article-header p {
    color: #334155;
    font-size: clamp(21px, 2vw, 26px);
    font-weight: 520;
    line-height: 1.45;
    max-width: 720px;
}

.kb-article-content {
    padding: 0;
}

.kb-body {
    max-width: 760px;
    color: var(--text, #1e293b);
    font-size: 19px;
    line-height: 1.78;
}

.kb-body h2,
.kb-body h3,
.kb-body h4 {
    color: var(--text, #1e293b);
    font-weight: 800;
    line-height: 1.25;
    scroll-margin-top: 96px;
}

.kb-body h2 {
    font-size: 28px;
    margin: 44px 0 14px;
}

.kb-body h3 {
    font-size: 22px;
    margin: 36px 0 14px;
}

.kb-body h4 {
    font-size: 18px;
    margin: 28px 0 12px;
}

.kb-body p,
.kb-body ul,
.kb-body ol,
.kb-body blockquote,
.kb-body table,
.kb-body figure {
    margin-bottom: 20px;
}

.kb-body ul,
.kb-body ol {
    padding-left: 26px;
}

.kb-body li {
    margin-bottom: 8px;
}

.kb-body a {
    color: var(--primary, #2563eb);
    text-decoration: underline;
    text-decoration-color: var(--primary-light, #dbeafe);
}

.kb-body blockquote {
    color: var(--text-secondary, #64748b);
    background: var(--bg-alt, #f1f5f9);
    border-left: 3px solid var(--accent, #f59e0b);
    border-radius: 0 var(--radius-sm, 10px) var(--radius-sm, 10px) 0;
    padding: 16px 22px;
}

.kb-body img,
.ck-content img {
    display: block;
    max-width: 100%;
    height: auto;
}

.kb-body figure.image,
.ck-content figure.image,
.kb-body .image,
.ck-content .image {
    clear: both;
    display: table;
    margin: 28px 0;
    max-width: 100%;
}

.kb-body figure.image img,
.ck-content figure.image img,
.kb-body .image img,
.ck-content .image img {
    border-radius: var(--radius-sm, 10px);
}

.kb-body figure.image-style-align-center,
.ck-content figure.image-style-align-center,
.kb-body .image-style-align-center,
.ck-content .image-style-align-center {
    margin-left: auto;
    margin-right: auto;
}

.kb-body figure.image-style-align-left,
.ck-content figure.image-style-align-left,
.kb-body .image-style-align-left,
.ck-content .image-style-align-left {
    float: left;
    margin: 6px 24px 18px 0;
}

.kb-body figure.image-style-align-right,
.ck-content figure.image-style-align-right,
.kb-body .image-style-align-right,
.ck-content .image-style-align-right {
    float: right;
    margin: 6px 0 18px 24px;
}

.kb-body figcaption,
.ck-content figcaption {
    caption-side: bottom;
    color: var(--text-secondary, #64748b);
    display: table-caption;
    font-size: 14px;
    padding-top: 8px;
    text-align: left;
}

.kb-body iframe,
.ck-content iframe {
    display: block;
    width: 100%;
    max-width: 820px;
    min-height: 360px;
    margin: 28px 0;
    border: 0;
    border-radius: var(--radius-sm, 10px);
}

.ck-content {
    min-height: 320px;
}

@media (max-width: 1080px) {
    .kb-article-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 26px;
    }

    .kb-toc {
        top: 72px;
        z-index: 5;
        max-height: none;
    }

    .kb-toc-inner {
        padding: 8px 0;
        background: rgba(255, 255, 255, 0.82);
        border-left: 0;
        border-radius: 16px;
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(16px) saturate(145%);
    }

    .kb-toc-head {
        display: none;
    }

    .kb-toc nav {
        flex-direction: row;
        gap: 8px;
        max-height: none;
        overflow-x: auto;
        scrollbar-width: none;
        padding: 2px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .kb-toc nav::-webkit-scrollbar {
        display: none;
    }

    .kb-toc a,
    .kb-toc a[data-level="3"],
    .kb-toc a[data-level="4"] {
        flex: 0 0 auto;
        max-width: min(68vw, 320px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 9px 14px;
        font-size: 13px;
        scroll-snap-align: start;
    }

    .kb-toc a::before {
        display: none;
    }

    .kb-toc a::after {
        inset: 3px;
    }

    .kb-toc a.is-active {
        transform: none;
    }
}

@media (max-width: 720px) {
    .kb-page {
        padding-top: 80px;
    }

    .kb-index-hero {
        padding-top: 48px;
    }

    .kb-card-list {
        grid-template-columns: 1fr;
    }

    .kb-search {
        flex-direction: column;
    }

    .kb-search button {
        padding: 14px 18px;
    }

    .kb-breadcrumbs {
        padding-top: 96px;
    }

    .kb-body,
    .kb-article-header p,
    .kb-article-lead {
        font-size: 17px;
    }

    .kb-body figure.image-style-align-left,
    .ck-content figure.image-style-align-left,
    .kb-body .image-style-align-left,
    .ck-content .image-style-align-left,
    .kb-body figure.image-style-align-right,
    .ck-content figure.image-style-align-right,
    .kb-body .image-style-align-right,
    .ck-content .image-style-align-right {
        float: none;
        margin: 24px 0;
    }

    .kb-body iframe,
    .ck-content iframe {
        min-height: 220px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kb-toc a,
    .kb-toc a::before,
    .kb-article-card {
        transition-duration: 0ms;
    }

    .kb-toc a.is-active,
    .kb-article-card:hover {
        transform: none;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .kb-toc-inner {
        backdrop-filter: none;
    }
}
