:root {
    --docs-topbar-height: 56px;
    --docs-sidebar-width: 240px;
    --docs-content-width: 720px;
}

html:has(> body > .docs-topbar) {
    scroll-padding-top: calc(var(--docs-topbar-height) + var(--space-4));
}

.docs-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--docs-topbar-height);
    background: var(--color-nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-subtle);
}

.docs-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.docs-topbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.docs-topbar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-brand);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--color-text-primary);
}

.docs-topbar-logo img {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
}

.docs-topbar-divider {
    width: 1px;
    height: 20px;
    background: var(--color-border);
}

.docs-topbar-section {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.docs-topbar-section:hover,
.docs-topbar-link:hover {
    color: var(--color-text-primary);
}

.docs-topbar-link {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.docs-shell {
    display: grid;
    grid-template-columns: var(--docs-sidebar-width) minmax(0, 1fr);
    gap: var(--space-12);
    max-width: 1200px;
    min-height: calc(100vh - var(--docs-topbar-height));
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.docs-sidebar {
    position: sticky;
    top: var(--docs-topbar-height);
    align-self: start;
    max-height: calc(100vh - var(--docs-topbar-height));
    padding: var(--space-8) 0;
    overflow-y: auto;
}

.docs-menu-toggle,
.docs-menu-label {
    display: none;
}

.docs-sidebar-nav ul {
    display: flex;
    flex-direction: column;
    gap: 2px;
    list-style: none;
}

.docs-sidebar-nav a {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--color-text-secondary);
}

.docs-sidebar-nav a:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
}

.docs-sidebar-nav a[aria-current='page'] {
    color: var(--color-text-primary);
    background: var(--color-accent-subtle);
    font-weight: 500;
}

.docs-sidebar-child a {
    padding-left: var(--space-6);
}

.docs-main {
    min-width: 0;
    max-width: var(--docs-content-width);
    padding: var(--space-8) 0 var(--space-16);
}

.docs-breadcrumb {
    margin-bottom: var(--space-4);
    font-size: 0.8125rem;
    line-height: 1.125rem;
    color: var(--color-text-muted);
}

.docs-breadcrumb a:hover {
    color: var(--color-text-primary);
}

.docs-header {
    margin-bottom: var(--space-8);
}

.docs-title {
    font-size: 1.75rem;
    line-height: 2.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.docs-meta {
    margin-top: var(--space-2);
    font-size: 0.8125rem;
    line-height: 1.125rem;
    color: var(--color-text-muted);
}

.docs-prose {
    font-size: 0.9375rem;
    line-height: 1.5rem;
    color: var(--color-text-secondary);
}

.docs-prose h2 {
    margin: var(--space-10) 0 var(--space-3);
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.docs-prose h3 {
    margin: var(--space-6) 0 var(--space-2);
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.docs-prose p,
.docs-prose li {
    margin-bottom: var(--space-3);
}

.docs-prose ul,
.docs-prose ol {
    margin: 0 0 var(--space-4) var(--space-6);
}

.docs-prose strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

.docs-prose a {
    color: var(--color-accent-text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.docs-prose a:hover {
    text-decoration-thickness: 2px;
}

.docs-prose code {
    padding: 0.1em 0.35em;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    font-size: 0.8125rem;
    color: var(--color-text-primary);
}

.docs-code {
    position: relative;
    margin: 0 0 var(--space-4);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    overflow: hidden;
}

.docs-code::before {
    content: attr(data-lang);
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.docs-code[data-file]::before {
    content: attr(data-file);
    text-transform: none;
}

.docs-code-copy {
    position: absolute;
    top: 4px;
    right: var(--space-2);
    height: 24px;
    padding: 0 var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.docs-code-copy:hover {
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

.docs-code-copy:focus-visible,
.docs-code pre:focus-visible,
.docs-topbar a:focus-visible,
.docs-sidebar-nav a:focus-visible,
.docs-pager a:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

.docs-code pre:focus-visible {
    outline-offset: -2px;
}

.docs-code pre {
    padding: var(--space-3) var(--space-4);
    overflow-x: auto;
    white-space: pre;
    font-size: 0.8125rem;
    line-height: 1.25rem;
}

.docs-code pre code {
    padding: 0;
    border: none;
    background: none;
    font-size: inherit;
}

.docs-tabs {
    margin: 0 0 var(--space-6);
}

.docs-tablist {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
}

.docs-tab {
    height: 32px;
    margin-bottom: -1px;
    padding: 0;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.docs-tab:hover {
    color: var(--color-text-primary);
}

.docs-tab[aria-selected='true'] {
    border-bottom-color: var(--color-text-primary);
    color: var(--color-text-primary);
}

.docs-tab:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

.docs-tab-panel::before {
    content: attr(data-tab-label);
    display: block;
    margin: var(--space-6) 0 var(--space-2);
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.docs-tabs[data-enhanced] .docs-tab-panel::before {
    content: none;
}

.docs-table-wrap {
    margin: 0 0 var(--space-4);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.docs-table-wrap:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

.docs-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.125rem;
}

.docs-table th,
.docs-table td {
    height: 36px;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
    text-align: left;
    vertical-align: top;
}

.docs-table th {
    background: var(--color-bg-secondary);
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
}

.docs-table tbody tr:last-child td {
    border-bottom: none;
}

.docs-table td:first-child,
.docs-table td:last-child {
    white-space: nowrap;
}

.docs-table.docs-table-settings {
    min-width: 640px;
}

.docs-table.docs-table-settings td {
    white-space: nowrap;
}

.docs-table.docs-table-settings td:last-child {
    min-width: 240px;
    white-space: normal;
}

.docs-callout {
    margin: var(--space-6) 0;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-color: color-mix(in srgb, var(--color-info) 30%, transparent);
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    background: color-mix(in srgb, var(--color-info) 10%, transparent);
}

.docs-index {
    list-style: none;
    margin: 0;
}

.docs-prose .docs-index {
    margin: 0;
}

.docs-index li {
    margin: 0;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}

.docs-index .docs-index-child {
    padding-left: var(--space-6);
}

.docs-index li:first-child {
    border-top: 1px solid var(--color-border-subtle);
}

.docs-prose .docs-index a {
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
}

.docs-prose .docs-index a:hover {
    text-decoration: underline;
}

.docs-index p {
    margin: var(--space-1) 0 0;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

/* Two fixed columns so a missing end never drags the other across. */
.docs-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border-subtle);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.docs-pager a:hover {
    color: var(--color-accent-text);
}

.docs-pager-next {
    grid-column: 2;
    text-align: right;
}

.docs-pager-label {
    display: block;
    margin-bottom: 2px;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

.docs-footer {
    border-top: 1px solid var(--color-border-subtle);
}

.docs-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-6);
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    font-size: 0.8125rem;
    line-height: 1.125rem;
    color: var(--color-text-muted);
}

.docs-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
}

.docs-footer a:hover {
    color: var(--color-text-primary);
}

@media (max-width: 767px) {
    .docs-topbar-inner,
    .docs-shell,
    .docs-footer-inner {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .docs-shell {
        display: block;
    }

    .docs-sidebar {
        position: static;
        max-height: none;
        padding: var(--space-3) 0 0;
        overflow: visible;
    }

    .docs-menu-toggle {
        display: block;
        position: absolute;
        width: 1px;
        height: 1px;
        opacity: 0;
    }

    .docs-menu-label {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 36px;
        padding: 0 var(--space-3);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--color-text-primary);
        cursor: pointer;
    }

    .docs-menu-label::after {
        content: '';
        width: 7px;
        height: 7px;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: translateY(-2px) rotate(45deg);
    }

    .docs-menu-toggle:checked + .docs-menu-label::after {
        transform: translateY(2px) rotate(-135deg);
    }

    .docs-menu-toggle:focus-visible + .docs-menu-label {
        outline: 2px solid var(--color-text-primary);
        outline-offset: 2px;
    }

    .docs-sidebar-nav {
        display: none;
        padding-top: var(--space-2);
    }

    .docs-menu-toggle:checked ~ .docs-sidebar-nav {
        display: block;
    }

    .docs-main {
        padding-top: var(--space-6);
    }
}
