    :root {
        --bs-primary: #0d6efd;
        --bs-primary-rgb: 13, 110, 253;
        --bs-secondary: #6c757d;
        --bs-success: #198754;
        --bs-info: #0dcaf0;
        --bs-warning: #ffc107;
        --bs-danger: #dc3545;
        --bs-light: #f8f9fa;
        --bs-dark: #212529;
        --bs-body-bg: #fff;
        --bs-body-color: #212529;
        --bs-border-color: #dee2e6;
        --bs-code-color: #d63384;
        --bs-link-color: #0d6efd;
        --bs-link-hover-color: #0a58ca;
        --doc-width: 794px;
    }

    [data-bs-theme="dark"] {
        --bs-body-bg: #212529;
        --bs-body-color: #f8f9fa;
        --bs-border-color: #495057;
        --bs-code-color: #e685b5;
        --bs-link-color: #6ea8fe;
        --bs-link-hover-color: #9ec5fe;
        --bs-light: #343a40;
        --bs-secondary: #adb5bd;
    }

    body {
        font-family: var(--bs-font-sans-serif);
        font-size: 1rem;
        font-weight: 400;
        line-height: 1.5;
        color: var(--bs-body-color);
        background-color: var(--bs-body-bg);
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }

    body {
        overflow: hidden;
    }

    .main-container {
        display: flex;
        min-height: 100vh;
    }

    /* Sidebar */
    .sidebar {
        width: 280px;
        background-color: var(--bs-body-bg);
        border-right: 1px solid var(--bs-border-color);
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        overflow-y: auto;
        z-index: 1000;
    }

    .sidebar-header {
        padding: 1rem;
        border-bottom: 1px solid var(--bs-border-color);
        background-color: var(--bs-light);
    }

    .sidebar-title {
        font-size: 1.25rem;
        font-weight: 600;
        margin: 0;
        color: var(--bs-body-color);
    }

    .sidebar-nav {
        padding: 1rem 0;
    }

    .nav-link {
        display: block;
        padding: 0.5rem 1rem;
        color: var(--bs-body-color);
        text-decoration: none;
        border: 0;
        border-radius: 0;
        transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
    }

    .nav-link:hover {
        color: var(--bs-link-hover-color);
        background-color: var(--bs-light);
    }

    .nav-link.active {
        color: var(--bs-primary);
        background-color: rgba(var(--bs-primary-rgb), 0.1);
        border-right: 3px solid var(--bs-primary);
    }

    .nav-link .nav-indent {
        margin-left: 1rem;
        font-size: 0.9rem;
        opacity: 0.8;
    }

    /* Main content */
    .main-content {
        flex: 1;
        margin-left: 280px;
        padding: 0rem;
        max-width: 1098px;
    }

    @page {
        size: 7in 9.25in;
        margin: 27mm 16mm 27mm 16mm;
    }

    div.chapter,
    div.appendix {
        page-break-after: always;
    }

    div.titlepage {
        page: blank;
    }

    @page {
        size: 21cm 29.7cm;
        margin: 30mm 45mm 30mm 45mm;
    }

    @media print {
        body {
            width: 21cm;
            height: 29.7cm;
            margin: 30mm 45mm 30mm 45mm;
        }
    }

    .content-container {
        max-width: var(--doc-width);
        max-height: 100vh;
        overflow: hidden;
    }

    .content-header {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--bs-border-color);
    }

    .content-title {
        font-size: 2.5rem;
        font-weight: 300;
        margin-bottom: 0.5rem;
        color: var(--bs-body-color);
    }

    .content-subtitle {
        font-size: 1.1rem;
        color: var(--bs-secondary);
        margin-bottom: 0;
    }

    /* Content styling */
    .content-body {
        font-size: 1rem;
        line-height: 1.7;
        color: var(--bs-body-color);
    }

    .content-body h1 {
        font-size: 2rem;
        font-weight: 500;
        margin-top: 2rem;
        margin-bottom: 1rem;
        color: var(--bs-body-color);
    }

    .content-body h2 {
        font-size: 1.5rem;
        font-weight: 500;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
        color: var(--bs-body-color);
    }

    .content-body h3 {
        font-size: 1.25rem;
        font-weight: 500;
        margin-top: 1.25rem;
        margin-bottom: 0.5rem;
        color: var(--bs-body-color);
    }

    .content-body h4 {
        font-size: 1.1rem;
        font-weight: 500;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        color: var(--bs-body-color);
    }

    .content-body h5 {
        font-size: 1rem;
        font-weight: 500;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        color: var(--bs-body-color);
    }

    .content-body h6 {
        font-size: 0.9rem;
        font-weight: 500;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        color: var(--bs-body-color);
    }

    .content-body p {
        margin-bottom: 0rem;
    }

    .content-body ul,
    .content-body ol {
        margin-bottom: 1rem;
        padding-left: 1.5rem;
    }

    .content-body li {
        margin-bottom: 0.25rem;
    }

    .content-body code {
        color: var(--bs-code-color);
        background-color: rgba(var(--bs-primary-rgb), 0.1);
        padding: 0.2rem 0.4rem;
        border-radius: 0.375rem;
        font-size: 0.875em;
        font-family: 'Courier New', Courier, monospace;
    }

    /* Dark mode specific inline code styling */
    [data-bs-theme="dark"] .content-body code {
        color: #e685b5;
    }

    .content-body pre {
        background-color: var(--bs-light);
        border: 1px solid var(--bs-border-color);
        border-radius: 0.375rem;
        padding: 1rem;
        margin: 1rem 0;
        overflow-x: auto;
        position: relative;
    }

    .content-body pre code {
        background-color: transparent;
        padding: 0;
        color: var(--bs-body-color);
        font-family: 'Courier New', Courier, monospace;
    }

    /* Dark mode specific code block styling */
    [data-bs-theme="dark"] .content-body pre {
        background-color: #2d3748;
        border-color: #4a5568;
    }

    [data-bs-theme="dark"] .content-body pre code {
        color: #e2e8f0;
    }

    .content-body blockquote {
        border-left: 4px solid var(--bs-primary);
        padding-left: 1rem;
        margin: 1rem 0;
        color: var(--bs-secondary);
        background-color: rgba(var(--bs-primary-rgb), 0.05);
        padding: 1rem;
        border-radius: 0.375rem;
    }

    /* Dark mode specific blockquote styling */
    [data-bs-theme="dark"] .content-body blockquote {
        background-color: rgba(110, 168, 254, 0.1);
        color: #adb5bd;
    }

    .content-body table {
        width: 100%;
        margin-bottom: 1rem;
        border-collapse: collapse;
    }

    .content-body th,
    .content-body td {
        padding: 0.425rem;
        border: 1px solid var(--bs-border-color);
        text-align: left;
    }

    .content-body th {
        background-color: var(--bs-light);
        font-weight: 600;
        color: var(--bs-body-color);
    }

    /* Dark mode specific table styling */
    [data-bs-theme="dark"] .content-body th {
        background-color: #343a40;
        color: #f8f9fa;
    }

    [data-bs-theme="dark"] .content-body td {
        color: #f8f9fa;
    }

    .content-body a {
        color: var(--bs-link-color);
        text-decoration: underline;
    }

    .content-body a:hover {
        color: var(--bs-link-hover-color);
    }

    .content-body img {
        max-width: 100%;
        height: auto;
        border-radius: 0.375rem;
    }

    .content-body hr {
        border: 0;
        border-top: 1px solid var(--bs-border-color);
        margin: 2rem 0rem;
    }

    /* Floating action buttons */
    .floating-actions {
        position: fixed;
        bottom: 2rem;
        right: 2rem;
        z-index: 1001;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .action-btn {
        width: 3.5rem;
        height: 3.5rem;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        color: #fff;
    }

    .action-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }

    .action-btn.primary {
        background-color: var(--bs-primary);
    }

    .action-btn.primary:hover {
        background-color: #0b5ed7;
    }

    .action-btn.secondary {
        background-color: var(--bs-secondary);
    }

    .action-btn.secondary:hover {
        background-color: #5c636a;
    }

    .action-btn.success {
        background-color: var(--bs-success);
    }

    .action-btn.success:hover {
        background-color: #157347;
    }

    .action-btn.info {
        background-color: var(--bs-info);
    }

    .action-btn.info:hover {
        background-color: #0aa2c0;
    }

    .action-btn.warning {
        background-color: var(--bs-warning);
    }

    .action-btn.warning:hover {
        background-color: #e0a800;
    }

    /* Search overlay */
    .search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1002;
        display: none;
        align-items: center;
        justify-content: center;
    }

    .search-modal {
        background-color: var(--bs-body-bg);
        border-radius: 0.5rem;
        padding: 2rem;
        width: 90%;
        max-width: 500px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }

    .search-input {
        width: 100%;
        padding: 0.75rem;
        border: 1px solid var(--bs-border-color);
        border-radius: 0.375rem;
        font-size: 1rem;
        background-color: var(--bs-body-bg);
        color: var(--bs-body-color);
    }

    .search-results {
        margin-top: 1rem;
        max-height: 300px;
        overflow-y: auto;
    }

    .search-result {
        padding: 0.5rem;
        border-bottom: 1px solid var(--bs-border-color);
        cursor: pointer;
    }

    .search-result:hover {
        background-color: var(--bs-light);
    }

    .search-result.highlight {
        background-color: rgba(var(--bs-warning-rgb), 0.2);
    }

    .search-section {
        margin-bottom: 1.5rem;
    }

    .search-section-title {
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--bs-secondary);
        margin-bottom: 0.5rem;
        padding: 0.25rem 0;
        border-bottom: 1px solid var(--bs-border-color);
    }

    .outline-item {
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

    .outline-item:hover {
        background-color: var(--bs-light);
    }

    .recent-item {
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

    .recent-item:hover {
        background-color: var(--bs-light);
    }

    /* Responsive */
    @media (max-width: 768px) {
        .sidebar {
            transform: translateX(-100%);
            transition: transform 0.3s ease-in-out;
        }

        .sidebar.show {
            transform: translateX(0);
        }

        .main-content {
            margin-left: 0;
            max-width: 100vw;
            padding: 1rem;
        }

        .content-container {
            max-width: 100%;
            padding: .5rem;
            margin: 0;
            box-shadow: none;
            border-radius: 0;
        }

        .floating-actions {
            bottom: 1rem;
            right: 1rem;
        }
    }

    /* Print styles */
    @media print {

        .sidebar,
        .floating-actions,
        .search-overlay {
            display: none !important;
        }

        .main-content {
            margin-left: 0 !important;
            max-width: none !important;
            padding: 0 !important;
        }

        .content-body {
            font-size: 12pt;
            line-height: 1.4;
        }
    }

    .main-content {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        width: 100vw;
        min-height: 100vh;
        box-sizing: border-box;
    }

    .outline-sidebar {
        flex: 0 0 230px;
        width: 230px;
        /* padding: 2rem 1rem 2rem 1rem; */
        position: sticky;
        top: 2rem;
        height: max-content;
        align-self: flex-start;
        background: none;
        z-index: 100;
        /* border-left                  : 1px solid var(--bs-border-color); */
    }

    @media (max-width: 1200px) {
        .outline-sidebar {
            display: none;
        }
    }

    .copy-block-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        background: var(--bs-light);
        color: var(--bs-primary);
        border: 1px solid var(--bs-border-color);
        border-radius: 50%;
        width: 2.2rem;
        height: 2.2rem;
        justify-content: center;
        cursor: pointer;
        margin: 0.5rem 0 1.5rem 0;
        font-size: 1.2rem;
        transition: background 0.2s, color 0.2s;
    }

    .copy-block-btn:hover {
        background: var(--bs-primary);
        color: #fff;
    }

    .copy-block-success {
        color: var(--bs-success);
        margin-left: 0.5rem;
        font-size: 1.1rem;
        font-weight: bold;
        vertical-align: middle;
    }

    .block-actions {
        display: flex;
        gap: 0.7rem;
        align-items: center;
        margin: 0.5rem 0 1.5rem 0;
        padding-left: 0.2rem;
        position: absolute;
        right: 0;
        top: -1rem;
    }

    .block-action-btn {
        background: none;
        border: none;
        color: var(--bs-primary);
        border-radius: 50%;
        width: 1.7rem;
        height: 1.7rem;
        display: inline !important;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1rem;
        transition: background 0.2s, color 0.2s;
        margin: 0;
        padding: 0;
        position: relative;
    }

    .block-action-btn:hover {
        background: var(--bs-primary);
        color: #fff;
    }

    .block-action-success {
        color: var(--bs-success);
        font-size: 0.95rem;
        font-weight: bold;
        min-width: 70px;
        text-align: left;
        position: absolute;
        left: 0.5rem;
        top: 100%;
        transform: translateY(0.2rem);
        background: none;
        z-index: 2;
        margin: 0;
        pointer-events: none;
        white-space: nowrap;
    }

    .hr-action-row {
        display: flex;
        align-items: center;
        width: 100%;
        margin-bottom: 0.5rem;
        justify-content: flex-end;
        position: relative;
    }

    .hr-action-row hr {
        flex: 1 1 auto;
        margin: 0;
        border: none;
        border-top: 1px solid var(--bs-border-color);
    }

    .block-action-success {
        color: var(--bs-success);
        font-size: 0.95rem;
        font-weight: bold;
        vertical-align: middle;
        min-width: 70px;
        text-align: left;
        position: absolute;
        left: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        z-index: 2;
        margin: 0;
        pointer-events: none;
    }

    .block-actions {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin: 0.1rem 0 0.5rem 0;
        /* background: rgba(33, 37, 41, 0.18); */
        border-radius: 1.2rem;
        padding: 0.05rem 0.1rem;
        min-width: unset;
        min-height: unset;
        gap: 0;
    }

    .block-action-btn {
        background: none;
        border: none;
        color: var(--bs-primary);
        border-radius: 50%;
        width: 1.7rem;
        height: 1.7rem;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1rem;
        transition: background 0.2s, color 0.2s;
        margin: 0;
        padding: 0;
    }

    .block-action-btn:hover {
        background: var(--bs-primary);
        color: #fff;
    }

    .pre-copy-btn {
        position: absolute;
        top: 0.4rem;
        right: 0.6rem;
        background: rgba(33, 37, 41, 0.18);
        color: var(--bs-primary);
        border: none;
        border-radius: 50%;
        width: 1.7rem;
        height: 1.7rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1rem;
        opacity: 0;
        transition: opacity 0.2s;
        z-index: 2;
    }

    .content-body pre:hover .pre-copy-btn {
        opacity: 1;
    }

    .block-hover-area {
        position: relative;
    }

    .block-actions {
        display: inline-block;
        justify-content: flex-end;
        align-items: center;
        /* background: rgba(33, 37, 41, 0.6); */
        border-radius: 1.2rem;
        min-width: unset;
        min-height: unset;
        gap: 0;
        opacity: 0;
        pointer-events: none;
        /* transition: opacity 0.2s; */
        float: right;
        /* position: relative; */
        margin-top: 0rem;
    }

    .block-hover-area:hover .block-actions {
        opacity: 1;
        pointer-events: auto;
    }

    .block-action-btn {
        background: none;
        border: none;
        color: var(--bs-primary);
        border-radius: 50%;
        width: 1.7rem;
        height: 1.7rem;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1rem;
        transition: background 0.2s, color 0.2s;
        margin: 0;
        padding: 0;
    }

    .block-action-btn:hover {
        background: var(--bs-primary);
        color: #fff;
    }

    #floating-toolbar {
        background: rgba(35, 39, 47, 0.95);
        /* dark semi-transparent for dark mode */
        border-radius: 8px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
        padding: 0.3rem 0.5rem;
        gap: 0.2rem;
        display: flex;
        align-items: center;
        /* transition: ...; */
        z-index: 3000;
        /* top: 1.2rem; */
        /* left: 50%; */
        /* transform: translateX(-50%); */
        min-width: 320px;
        max-width: 600px;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: #fff;
    }

    [data-bs-theme="light"] #floating-toolbar {
        background: rgba(255, 255, 255, 0.98);
        /* light semi-transparent for light mode */
        color: #222;
        border: 1px solid #ddd;
    }

    #floating-toolbar button {
        width: 2.2rem;
        height: 2.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: transparent;
        border: none;
        color: inherit;
        font-size: 1rem;
        margin: 0;
        padding: 0;
        cursor: pointer;
        transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    }

    .edit-toolbar-container .bi::before,
    .edit-toolbar-container [class*=" bi-"]::before {
        vertical-align: unset !important;
    }

    #floating-toolbar button:hover {
        background: rgba(13, 110, 253, 0.18);
        /* blue highlight, adjust for theme if needed */
        color: #0d6efd;
        box-shadow: 0 2px 8px rgba(13, 110, 253, 0.08);
    }

    #floating-toolbar button i,
    #floating-toolbar button svg {
        width: 1.2rem;
        height: 1.2rem;
        color: inherit !important;
        fill: currentColor !important;
        display: inline-block;
        border-radius: 0;
        transition: color 0.15s;
    }

    [data-bs-theme="dark"] #floating-toolbar button i,
    [data-bs-theme="dark"] #floating-toolbar button svg {
        color: #fff !important;
        fill: #fff !important;
    }

    [data-bs-theme="light"] #floating-toolbar button i,
    [data-bs-theme="light"] #floating-toolbar button svg {
        color: #222 !important;
        fill: #222 !important;
    }

    #table-toolbar {
        background: rgba(35, 39, 47, 0.9);
        border-radius: 8px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
        padding: 0.2rem 0.4rem;
        gap: 0.2rem;
        display: flex;
        align-items: center;
        position: absolute;
        z-index: 3100;
        display: none;
    }

    #table-toolbar button {
        background: transparent;
        border: none;
        color: #fff;
        font-size: 1rem;
        margin: 0 0.1rem;
        padding: 0.2rem 0.5rem;
        border-radius: 4px;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
    }

    #table-toolbar button:hover {
        background: #0d6efd;
        color: #fff;
    }

    .toolbar-table-group {
        display: flex;
        gap: 0.1rem;
        border-left: 1px solid rgba(255, 255, 255, 0.12);
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }

    #floating-toolbar button i {
        font-size: 1.2rem;
        vertical-align: middle;
        color: var(--bs-body-color);
    }

    [data-bs-theme="dark"] #floating-toolbar button i {
        color: #fff;
    }

    .edit-toolbar-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        /* margin-bottom: 1.2rem; */
        margin: 0 !important;
        z-index: 10;
        background: rgba(35, 39, 47, 0.95);
        padding: .5rem;
    }

    [data-bs-theme="light"] .edit-toolbar-container {
        background: rgba(255, 255, 255, 0.98);
        /* light semi-transparent for light mode */
        color: #222;
        border: 1px solid #ddd;
    }

    #floating-toolbar button {
        width: 2rem;
        height: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: transparent;
        border: none;
        color: inherit;
        font-size: 1.1rem;
        margin: 0 0.1rem;
        padding: 0;
        cursor: pointer;
        transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    }

    .toolbar-table-group .bi::before {
        vertical-align: unset;
    }

    #floating-toolbar button:hover {
        background: rgba(13, 110, 253, 0.18);
        /* blue highlight, adjust for theme if needed */
        color: #0d6efd;
        box-shadow: 0 2px 8px rgba(13, 110, 253, 0.08);
    }

    #floating-toolbar button i,
    #floating-toolbar button svg {
        width: 1.2rem;
        height: 1.2rem;
        color: inherit !important;
        fill: currentColor !important;
        display: inline-block;
        border-radius: 0;
        transition: color 0.15s;
    }

    [data-bs-theme="dark"] #floating-toolbar button i,
    [data-bs-theme="dark"] #floating-toolbar button svg {
        color: #fff !important;
        fill: #fff !important;
    }

    [data-bs-theme="light"] #floating-toolbar button i,
    [data-bs-theme="light"] #floating-toolbar button svg {
        color: #222 !important;
        fill: #222 !important;
    }

    #table-toolbar {
        background: rgba(35, 39, 47, 0.9);
        border-radius: 8px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
        padding: 0.2rem 0.4rem;
        gap: 0.2rem;
        display: flex;
        align-items: center;
        position: absolute;
        z-index: 3100;
        display: none;
    }

    #table-toolbar button {
        background: transparent;
        border: none;
        color: #fff;
        font-size: 1rem;
        margin: 0 0.1rem;
        padding: 0.2rem 0.5rem;
        border-radius: 4px;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
    }

    #table-toolbar button:hover {
        background: #0d6efd;
        color: #fff;
    }

    .toolbar-table-group {
        display: flex;
        gap: 0.1rem;
        border-left: 1px solid rgba(255, 255, 255, 0.12);
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }

    #floating-toolbar button i {
        font-size: 1.2rem;
        vertical-align: middle;
        color: var(--bs-body-color);
    }

    [data-bs-theme="dark"] #floating-toolbar button i {
        color: #fff;
    }

    .edit-toolbar-container {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        gap: 0;
        margin-bottom: 1.2rem;
        position: absolute;
    }

    .edit-toolbar-container .edit-back-btn {
        margin-left: 0.5rem;
        flex: 0 0 auto;
    }

    .edit-toolbar-container .edit-actions {
        margin-right: 0.5rem;
        flex: 0 0 auto;
    }

    .edit-toolbar-container #floating-toolbar {
        flex: 1 1 0;
        display: flex;
        justify-content: center;
        margin: 0 1rem;
        min-width: 320px;
        max-width: 600px;
    }

    /* Mini/full sidebar styles */
    .sidebar {
        width: 280px;
        transition: width 0.3s;
    }

    .sidebar.mini {
        width: 64px;
    }

    .sidebar.mini .sidebar-title,
    .sidebar.mini .sidebar-text,
    .sidebar.mini .bi-chevron-down,
    .sidebar.mini .float-end {
        display: none !important;
    }

    .sidebar.mini .nav-link {
        text-align: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .sidebar-header {
        transition: padding 0.3s;
    }

    .sidebar.mini .sidebar-header {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    #docApp {
        display: flex;
    }

    .main-content {
        transition: margin-left 0.3s;
    }

    body .main-content {
        margin: 0rem auto;
    }

    body.mini-sidebar .main-content {
        margin: 0rem auto;
    }

    @media (max-width: 768px) {
        .sidebar {
            width: 0 !important;
        }

        .sidebar.mini {
            width: 0 !important;
        }

        body .main-content,
        body.mini-sidebar .main-content {
            margin: 1rem auto;
        }
    }

    .sidebar {
        position: inherit;
        width: 280px;
        height: 100vh;
        background: var(--bs-body-bg);
        border-right: 1px solid var(--bs-border-color);
        display: flex;
        flex-direction: column;
        z-index: 1000;
        /* Không dùng overflow-y: auto ở đây! */
    }

    .sidebar-header {
        flex: 0 0 auto;
        padding: 1rem;
        border-bottom: 1px solid var(--bs-border-color);
        background: var(--bs-light);
        z-index: 2;
    }

    .sidebar-profile {
        flex: 0 0 auto;
        padding: 1.5rem 0 1rem 0;
        background: inherit;
        display: flex;
        flex-direction: column;
        align-items: center;
        z-index: 2;
    }

    .sidebar-nav {
        flex: 1 1 auto;
        overflow: hidden;
        min-height: 0;
        max-height: 90vh;

        /* Đảm bảo không bị che bởi profile */
    }

    .modal-backdrop-custom {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 2000;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .edit-modal {
        background: var(--bs-body-bg);
        color: var(--bs-body-color);
        /* border-radius: 0.5rem; */
        /* box-shadow: 0 8px 32px rgba(0,0,0,0.3); */
        padding: 0;
        width: calc(var(--doc-width) + 30px);
        height: 100vh;
        display: flex;
        flex-direction: column;
        z-index: 2100;
        position: relative;
        font: inherit;
        margin-right: 50px;
    }

    .edit-modal .edit-back-btn {
        /* position: absolute; */
        /* top: 1.2rem; */
        /* left: 1.2rem; */
        background: none;
        border: none;
        color: var(--bs-primary);
        font-size: 1.7rem;
        cursor: pointer;
        z-index: unset;
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }

    .edit-modal .edit-actions {
        /* position: absolute; */
        /* top: 1.5rem; */
        /* right: 1.5rem; */
        z-index: unset;
        display: flex;
        gap: 1.5rem;
        align-items: center;
    }

    .edit-modal .edit-action-link {
        color: var(--bs-link-color);
        background: none;
        border: none;
        font-size: 1.1rem;
        cursor: pointer;
        text-decoration: underline;
        padding: 0;
    }

    .edit-modal .edit-action-link:hover {
        color: var(--bs-link-hover-color);
    }

    .edit-modal .edit-markdown-area {
        flex: 1;
        margin-top: 3rem;
        margin-bottom: .5rem;
        padding: 2rem 1.5rem 2rem 1.5rem;
        background: var(--bs-body-bg);
        color: var(--bs-body-color);
        border: none;
        border-radius: 0.5rem;
        resize: none;
        outline: none;
        width: 100%;
        min-height: 300px;
        box-sizing: border-box;
        overflow: auto;
        font: inherit;
    }

    table {
        border-collapse: collapse;
        border-color: inherit;
        text-indent: 0;
        font-size: .875em;
        line-height: 1.71429;
        margin-bottom: 2em;
        margin-top: 2em;
        table-layout: auto;
        width: 100%;
    }

    .scrollable-content {
        overflow: hidden;
        padding: .5rem;
        scrollbar-width: thin;
        max-height: 100vh;
        scrollbar-color: var(--bs-border-color) var(--bs-light);
        scrollbar-gutter: stable;    /* optional if you want consistent space */
    }

    .scrollable-content:hover {
        /* Show scrollbars on hover */
        overflow-y: auto;

    }
    .scrollable-content::-webkit-scrollbar {
        width: 1rem;
        /* position: absolute; */
        /* behaves like overlay */
    }

    .scrollable-content::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 4px;
    }
    .scrollable-content:active::-webkit-scrollbar-thumb,
    .scrollable-content:focus::-webkit-scrollbar-thumb,
    .scrollable-content:hover::-webkit-scrollbar-thumb {
        visibility: visible;
    }

    .scrollable-content:hover::-webkit-scrollbar-thumb {
        visibility: visible;
    }

    .circle-btn {
        border: none;
        border-radius: 50%;
    }

    #quick-share-btn {
        background: linear-gradient(135deg,#00c3ff,#3a7bd5);
        box-shadow: 0 2px 8px #0004;
    }

    #quick-gallery-btn {
        background: linear-gradient(135deg,#3b82f6,#06b6d4);
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    }
    #quick-gallery-btn:hover {
        box-shadow: 0 4px 16px rgba(0,0,0,0.28);
    }

    
[data-bs-theme="dark"] .sidebar-nav .selected .custom-checkbox-label {
    /* --bs-primary-bg-subtle: rgba(var(--bs-primary-rgb), 0.2) !important; */
    color: var(--bs-link-hover-color);
    background-color: var(--bs-light) !important;
}
