.notebook-page {
    min-height: 100vh;
}

.notebook-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 2rem;
    padding: 1.5rem;
    align-items: start;
}

.notebook-sidebar {
    position: sticky;
    top: 6rem;
    align-self: start;
    min-height: calc(100vh - 7rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notebook-sidebar-header {
    padding: 0 0 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.notebook-sidebar-header h1 {
    margin: 0;
    font-size: 1.1rem;
}

.notebook-loading,
.notebook-result-snippet {
    color: var(--text-secondary);
}

mark.notebook-search-highlight {
    background: rgba(255, 200, 0, 0.35);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.notebook-instance-select {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    border-radius: 0;
    cursor: pointer;
}

.notebook-menu-button,
.notebook-note-button,
.notebook-result-button {
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.notebook-menu-button {
    padding: 0.45rem 0.45rem;
    font-size: 0.88rem;
    border: 1px solid var(--border-light);
    color: var(--bg-primary);
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 1100;
    background: var(--text-primary);
    border-radius: 0;
}

.notebook-menu-button {
    display: none;
}

.notebook-search {
    margin: 0.75rem 0 0;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-light);
    background: var(--bg-primary);
    font-size: 0.95rem;
    border-radius: 0;
    box-shadow: none;
}

.notebook-sidebar-body {
    padding: 0.75rem 0 0;
    overflow-y: auto;
    min-height: 0;
}

.notebook-tree,
.notebook-results {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.notebook-folder {
    overflow: visible;
}

.notebook-folder summary {
    list-style: none;
    cursor: pointer;
    padding: 0.2rem 0;
}

.notebook-folder summary::-webkit-details-marker {
    display: none;
}

.notebook-folder summary::before {
    content: '▸';
    margin-right: 0.4rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.notebook-folder[open] summary::before {
    content: '▾';
}

.notebook-folder-children {
    margin-left: 0.45rem;
    padding: 0 0 0 0.8rem;
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.notebook-note-button,
.notebook-result-button {
    width: 100%;
    text-align: left;
    padding: 0.28rem 0.4rem;
    border-radius: 0;
}

.notebook-note-button.is-active,
.notebook-result-button.is-active {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.notebook-note-title,
.notebook-result-title {
    display: block;
    font-weight: 400;
}

.notebook-main {
    min-width: 0;
}

.notebook-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.notebook-topbar h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
}

.notebook-article {
    padding: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
}

.notebook-content {
    font-size: 1.03rem;
    line-height: 1.75;
}

.notebook-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

.notebook-content p,
.notebook-result-snippet {
    text-align: left;
}

.notebook-content pre {
    overflow-x: auto;
}

.notebook-results[hidden],
.notebook-tree[hidden] {
    display: none;
}

.notebook-overlay {
    display: none;
}

@media (max-width: 920px) {
    .notebook-shell {
        grid-template-columns: minmax(0, 1fr);
        padding: 1rem;
    }

    .notebook-menu-button {
        display: inline-flex;
    }

    .notebook-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 360px);
        min-height: 100vh;
        z-index: 1200;
        padding: 1rem;
        background: var(--bg-primary);
        border-right: 1px solid var(--border-light);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }

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

    .notebook-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 12, 10, 0.45);
        z-index: 1100;
    }

    .notebook-overlay.is-visible {
        display: block;
    }

    .notebook-main {
        min-width: 0;
    }
}