/* ============================================================
   Book / docs pages — sidebar table-of-contents & prev/next nav
   ============================================================ */

.dd-with-sidebar { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: max-content minmax(0, 1fr); max-width: none; margin: 0; min-height: calc(100vh - 120px); }
.dd-with-sidebar > .crumbs { grid-column: 2; grid-row: 1; max-width: none; margin: 0 0 56px; padding: 28px 56px 0; font-size: 17px; }
.dd-with-sidebar > .crumbs ol { gap: 0; }
.dd-with-sidebar > .crumbs li + li::before { padding: 0 12px; }
.dd-with-sidebar > .crumbs li, .dd-with-sidebar > .crumbs a { color: #4a5568; }
.dd-with-sidebar > .crumbs a:hover { text-decoration: none; }
.dd-with-sidebar > .crumbs [aria-current="page"] { color: #1a2332; }
.dd-with-sidebar > .dd-page-content { grid-column: 2; grid-row: 2; width: 100%; max-width: 1000px; margin: 0; padding: 0 56px 80px; }
.dd-with-sidebar .dd-page-title { margin: 0 0 28px; padding: 0; border: 0; color: #1a2332; font-size: 48px; font-weight: 700; line-height: 1.1; }
.dd-book-body { max-width: 820px; color: #2d3748; font-size: 18px; line-height: 1.6; }
.dd-sidebar { width: 300px; min-width: 300px; grid-column: 1; grid-row: 1 / span 2; background: #fff; border-right: 1px solid #e1e5ea; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 2px; }


.dd-sidebar-tree { display: flex; flex-direction: column; gap: 2px; list-style: none; padding: 0; margin: 0; }
.dd-sidebar-tree ul { display: none; flex-direction: column; gap: 2px; list-style: none; padding: 0; margin: 0; }
.dd-sidebar-tree ul.open { display: flex; }
.dd-sidebar-root > li > .dd-sidebar-tree { margin: 2px 0 8px; }
.dd-sidebar-tree li { margin: 0; }
.dd-sidebar-item { display: flex; align-items: center; border-radius: 10px; }
.dd-sidebar-item:hover { background: #eef5fc; }
.dd-sidebar-tree a { display: block; padding: 8px 12px; border-radius: 8px; color: #4a5568; background: transparent; font: inherit; font-size: 16px; line-height: 1.35; text-align: left; text-decoration: none; transition: background 0.15s, color 0.15s; }
.dd-sidebar-tree a:hover { color: #2f86d8; background: #eef5fc; }
.dd-sidebar-tree a.dd-sidebar-parent-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dd-sidebar-caret { flex: none; color: #6b7482; font-size: 10px; transition: transform 0.15s; }
.dd-sidebar-caret.is-open { transform: rotate(180deg); }
.dd-sidebar-tree > li > .dd-sidebar-item > a { flex: 1; min-width: 0; padding: 10px 14px; color: #4a5568; font-size: 17px; font-weight: 400; line-height: 24px; }
.dd-sidebar-tree > li > .dd-sidebar-item > a:hover { color: #4a5568; background: transparent; }
.dd-sidebar-tree li.active > .dd-sidebar-item > a { color: #2f86d8; font-weight: 600; }
.dd-sidebar-tree li.active > a { color: #fff; background: #2f86d8; font-weight: 700; }
.dd-sidebar-tree li.active > a:hover { color: #fff; background: #2a78c4; }

@media (max-width: 767px) {
    .dd-with-sidebar { grid-template-columns: 1fr; grid-template-rows: auto; }
    .dd-with-sidebar > .crumbs,
    .dd-with-sidebar > .dd-page-content,
    .dd-sidebar { grid-column: 1; grid-row: auto; }
    .dd-sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid #e1e5ea; }
    .dd-with-sidebar > .crumbs { margin-bottom: 28px; padding: 24px 20px 0; }
    .dd-with-sidebar > .dd-page-content { padding: 0 20px 48px; }
    .dd-with-sidebar .dd-page-title { font-size: clamp(36px, 8vw, 48px); }
}

/* Book Nav (Prev/Next) */
.dd-book-nav {
    display: flex; justify-content: space-between;
    margin-top: 3rem; padding-top: 1.5rem;
    border-top: 1px solid var(--dd-border);
}
.dd-book-nav a {
    color: var(--dd-green); text-decoration: none;
    font-weight: 500; max-width: 45%;
}
.dd-book-nav a:hover { color: var(--dd-green-hover); }
