.kb-docs-wrap {
    --kb-surface: var(--wp--preset--color--base, #ffffff);
    --kb-surface-muted: color-mix(in srgb, var(--kb-surface) 88%, #eef3f8);
    --kb-text: var(--wp--preset--color--contrast, #1f2933);
    --kb-muted: #667085;
    --kb-border: color-mix(in srgb, var(--kb-text) 14%, transparent);
    --kb-accent: var(--wp--preset--color--accent-3, #2563eb);
    --kb-accent-soft: color-mix(in srgb, var(--kb-accent) 10%, var(--kb-surface));
    color: var(--kb-text);
}

.kb-docs-wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.kb-docs-app {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.kb-app-sidebar {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--kb-border);
    border-radius: 8px;
    padding: 16px;
    background: var(--kb-surface);
}

.kb-app-sidebar__brand {
    margin-bottom: 14px;
    font-size: 18px;
    font-weight: 700;
}

.kb-app-sidebar__brand a {
    color: var(--kb-text);
    text-decoration: none;
}

.kb-app-sidebar__search {
    margin-bottom: 16px;
}

.kb-app-sidebar__search .kb-search {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.kb-app-sidebar__search .kb-search h2,
.kb-app-sidebar__search .kb-search-results {
    display: none;
}

.kb-app-nav,
.kb-app-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.kb-app-product {
    padding: 10px 0;
    border-top: 1px solid var(--kb-border);
}

.kb-app-product:first-child {
    border-top: 0;
}

.kb-app-product__link,
.kb-app-page-list a {
    display: block;
    border-radius: 6px;
    color: var(--kb-text);
    text-decoration: none;
}

.kb-app-product__link {
    padding: 8px 10px;
    font-weight: 700;
}

.kb-app-page-list a {
    padding: 6px 10px 6px 22px;
    color: var(--kb-muted);
    font-size: 14px;
    line-height: 1.35;
}

.kb-app-product__link:hover,
.kb-app-page-list a:hover,
.kb-app-product.is-active > .kb-app-product__link,
.kb-app-page-list li.is-active > a {
    background: var(--kb-accent-soft);
    color: var(--kb-accent);
}

.kb-app-main {
    min-width: 0;
}

.kb-docs-home > h1,
.kb-docs-product > h1,
.kb-docs-version > h1 {
    margin-top: 0;
}

.kb-product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.kb-home-card,
.kb-product-card,
.kb-search {
    border: 1px solid var(--kb-border);
    border-radius: 8px;
    padding: 20px;
    background: var(--kb-surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.kb-docs-home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
    gap: 16px;
    margin-bottom: 16px;
}

.kb-home-card h2 {
    margin-top: 0;
    font-size: 20px;
}

.kb-home-intro__content p:last-child,
.kb-product-updates p:last-child {
    margin-bottom: 0;
}

.kb-product-updates__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.kb-product-updates__list li {
    padding: 12px 0;
    border-top: 1px solid var(--kb-border);
}

.kb-product-updates__list li:first-child {
    padding-top: 0;
    border-top: 0;
}

.kb-product-updates__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
}

.kb-product-updates__meta strong {
    color: var(--kb-text);
}

.kb-product-updates__meta span,
.kb-product-updates__meta time,
.kb-empty-state {
    color: var(--kb-muted);
    font-size: 14px;
}

.kb-product-card h2 {
    margin-top: 0;
    font-size: 20px;
}

.kb-product-card ul,
.kb-version-list,
.kb-page-list {
    margin-left: 0;
    padding-left: 0;
    list-style: none;
}

.kb-product-card li,
.kb-version-list li,
.kb-page-list li {
    margin: 7px 0;
}

.kb-doc-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

.kb-sidebar {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-right: 1px solid var(--kb-border);
    padding: 8px 22px 16px 0;
}

.kb-version-switcher select,
.kb-sidebar select,
.kb-search input {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--kb-border);
    border-radius: 6px;
    background: var(--kb-surface);
    color: var(--kb-text);
}

.kb-sidebar-nav ul {
    list-style: none;
    margin: 12px 0 0;
    padding-left: 0;
}

.kb-sidebar-nav ul ul {
    padding-left: 16px;
}

.kb-sidebar-nav a,
.kb-sidebar-nav span {
    display: block;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.35;
    text-decoration: none;
    color: var(--kb-text);
}

.kb-sidebar-nav a:hover {
    background: var(--kb-accent-soft);
    color: var(--kb-accent);
}

.kb-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    color: var(--kb-muted);
    font-size: 14px;
}

.kb-breadcrumbs a {
    color: inherit;
    text-decoration: none;
}

.kb-breadcrumbs a:hover {
    color: var(--kb-accent);
}

.kb-rendered-content pre {
    overflow: auto;
    padding: 16px;
    background: #1e1e1e;
    color: #f8f8f2;
    border-radius: 6px;
}

.kb-doc-content,
.kb-docs-version {
    max-width: 860px;
    min-width: 0;
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius, 8px);
    padding: 22px;
    background: var(--kb-surface);
    box-shadow: var(--kb-shadow, 0 1px 2px rgba(16, 24, 40, 0.04));
}

.kb-doc-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 22px;
}

.kb-doc-header__main {
    min-width: 0;
}

.kb-doc-header h1 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
}

.kb-version-switcher {
    flex: 0 0 190px;
}

.kb-version-switcher label {
    display: block;
    margin-bottom: 6px;
    color: var(--kb-muted);
    font-size: 13px;
    font-weight: 700;
}

.kb-rendered-content h1 {
    display: none;
}

.kb-rendered-content h2,
.kb-rendered-content h3,
.kb-rendered-content h4 {
    scroll-margin-top: 24px;
    margin-top: 32px;
}

.kb-rendered-content p,
.kb-rendered-content li {
    line-height: 1.7;
}

.kb-rendered-content a {
    color: var(--kb-accent);
    text-underline-offset: 3px;
}

.kb-admonition {
    border-left: 4px solid var(--kb-accent);
    border-radius: 0 6px 6px 0;
    padding: 14px 16px;
    background: var(--kb-accent-soft);
    margin: 18px 0;
}

.kb-image img {
    max-width: 100%;
    height: auto;
}

.kb-current-version {
    margin-left: 8px;
    font-size: 12px;
    color: var(--kb-accent);
}

.kb-search-form {
    display: flex;
    gap: 8px;
}

.kb-search button {
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    padding: 0 16px;
    background: var(--kb-accent);
    color: #fff;
    cursor: pointer;
}

@media (max-width: 780px) {
    .kb-docs-app {
        grid-template-columns: 1fr;
    }

    .kb-docs-home-grid {
        grid-template-columns: 1fr;
    }

    .kb-app-sidebar {
        position: static;
        max-height: none;
    }

    .kb-doc-layout {
        grid-template-columns: 1fr;
    }

    .kb-sidebar {
        position: static;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--kb-border);
        padding-right: 0;
        padding-bottom: 18px;
    }

    .kb-doc-header {
        display: block;
    }

    .kb-version-switcher {
        margin-top: 16px;
    }
}
