        :root {
            --bg: #f8fafc;
            --surface: #ffffff;
            --surface2: #f1f5f9;
            --border: #e2e8f0;
            --border2: #cbd5e1;
            --text: #0f172a;
            --text2: #334155;
            --text3: #64748b;
            --accent: #2563eb;
            --accent-bg: #eff6ff;
            --accent2: #0284c7;
            --green: #059669;
            --green-bg: #ecfdf5;
            --amber: #d97706;
            --amber-bg: #fffbeb;
            --red: #dc2626;
            --purple: #7c3aed;
            --purple-bg: #f5f3ff;
        }

        [data-theme="dark"] {
            --bg: #020617;
            --surface: #0f172a;
            --surface2: #1e293b;
            --border: #334155;
            --border2: #475569;
            --text: #f8fafc;
            --text2: #94a3b8;
            --text3: #64748b;
            --accent: #3b82f6;
            --accent-bg: rgba(59, 130, 246, 0.15);
            --accent2: #38bdf8;
            --green: #10b981;
            --green-bg: rgba(16, 185, 129, 0.15);
            --amber: #f59e0b;
            --amber-bg: rgba(245, 158, 11, 0.15);
            --red: #ef4444;
            --purple: #a855f7;
            --purple-bg: rgba(168, 85, 247, 0.15);
        }

        * {
            box-sizing: border-box;
        }

        body {
            font-family: 'DM Sans', sans-serif;
            background: var(--bg);
            color: var(--text);
            height: 100vh;
            display: flex;
            overflow: hidden;
            margin: 0;
        }

        /* ── Scrollbar ── */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: transparent;
        }

        ::-webkit-scrollbar-thumb {
            background: var(--border2);
            border-radius: 3px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--text3);
        }

        /* ── Sidebar ── */
        #sidebar {
            width: 280px;
            flex-shrink: 0;
            background: var(--surface);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
            transition: width 0.3s ease;
            z-index: 20;
        }

        .sidebar-logo {
            padding: 20px 20px 16px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .logo-icon {
            width: 34px;
            height: 34px;
            background: var(--accent);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .logo-icon i {
            color: #fff;
            font-size: 16px;
        }

        .logo-text {
            font-size: 18px;
            font-weight: 700;
            color: var(--text);
            letter-spacing: -0.3px;
        }

        .logo-badge {
            font-size: 12px;
            font-weight: 600;
            background: var(--accent-bg);
            color: var(--accent);
            padding: 2px 6px;
            border-radius: 20px;
            margin-left: auto;
            white-space: nowrap;
        }

        /* Search box */
        .sidebar-search {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
        }

        .search-input-wrap {
            display: flex;
            align-items: center;
            gap: 8px;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 7px 10px;
            transition: border-color 0.2s;
        }

        .search-input-wrap:focus-within {
            border-color: var(--accent);
            background: var(--surface);
        }

        .search-input-wrap i {
            color: var(--text3);
            font-size: 14px;
        }

        .search-input-wrap input {
            border: none;
            background: transparent;
            font-size: 15px;
            color: var(--text);
            outline: none;
            width: 100%;
            font-family: 'DM Sans', sans-serif;
        }

        .search-input-wrap input::placeholder {
            color: var(--text3);
        }

        /* Nav sections */
        .sidebar-nav {
            flex: 1;
            overflow-y: auto;
            padding: 12px 0;
        }

        .nav-section-label {
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text3);
            padding: 8px 20px 4px;
        }

        /* Module cards in sidebar */
        .module-item {
            margin: 2px 10px;
            border-radius: 8px;
            overflow: hidden;
        }

        .module-btn {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 9px 12px;
            border: none;
            background: transparent;
            cursor: pointer;
            border-radius: 8px;
            transition: background 0.15s;
            text-align: left;
        }

        .module-btn:hover {
            background: var(--surface2);
        }

        .module-btn.active {
            background: var(--accent-bg);
        }

        .module-icon {
            width: 28px;
            height: 28px;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 14px;
        }

        .module-title {
            font-size: 15px;
            font-weight: 500;
            color: var(--text);
            flex: 1;
        }

        .module-btn.active .module-title {
            color: var(--accent);
            font-weight: 600;
        }

        .module-chevron {
            color: var(--text3);
            font-size: 12px;
            transition: transform 0.2s;
        }

        .module-chevron.open {
            transform: rotate(180deg);
        }

        /* ── Submenu ── */
        .submenu {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
            padding-left: 36px;
            margin-bottom: 4px;
        }

        .submenu.open {
            max-height: 2000px;
        }

        .submenu-section {
            overflow: hidden;
            margin: 2px 0;
        }

        .submenu-section-btn {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            border: none;
            background: transparent;
            cursor: pointer;
            border-radius: 6px;
            transition: background 0.15s;
            text-align: left;
            font-family: 'DM Sans', sans-serif;
            border-left: 2px solid transparent;
        }

        .submenu-section-btn:hover {
            background: var(--surface2);
        }

        .submenu-section-title {
            font-size: 15.5px;
            font-weight: 600;
            color: var(--text);
            flex: 1;
        }

        .submenu-section-chevron {
            color: var(--text3);
            font-size: 12px;
            transition: transform 0.2s, color 0.2s;
        }

        .submenu-section-chevron.open {
            transform: rotate(180deg);
            color: var(--accent);
        }

        .submenu-items {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.25s ease;
            padding-left: 12px;
            border-left: 1px solid var(--border2);
            margin-left: 12px;
        }

        .submenu-items.open {
            max-height: 800px;
            margin-top: 4px;
            margin-bottom: 4px;
        }

        .submenu-link {
            display: block;
            padding: 7px 12px 7px 16px;
            font-size: 15px;
            font-weight: 500;
            color: var(--text2);
            text-decoration: none;
            border-radius: 5px;
            transition: color 0.15s, background 0.15s;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            position: relative;
        }

        .submenu-link::before {
            content: '';
            position: absolute;
            left: -1px;
            top: 50%;
            width: 8px;
            height: 1px;
            background-color: var(--border2);
        }

        .submenu-link:hover {
            color: var(--accent);
            background: var(--surface2);
        }

        .submenu-link.active {
            color: var(--accent);
            font-weight: 600;
            background: var(--accent-bg);
        }

        .submenu-link.active::before {
            background-color: var(--accent);
        }

        .submenu-direct-link {
            display: block;
            padding: 8px 12px;
            font-size: 15.5px;
            font-weight: 600;
            color: var(--text2);
            text-decoration: none;
            border-radius: 6px;
            transition: color 0.15s, background 0.15s;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            border-left: 2px solid transparent;
        }

        .submenu-direct-link:hover {
            color: var(--text);
            background: var(--surface2);
        }

        .submenu-direct-link.active {
            color: var(--accent);
            font-weight: 600;
            background: var(--accent-bg);
            border-left-color: var(--accent);
        }

        /* ── Sidebar footer ── */
        .sidebar-footer {
            padding: 14px 20px;
            border-top: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .status-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--green);
            animation: pulse 2s infinite;
        }

        @keyframes pulse {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.4;
            }
        }

        .sidebar-footer-text {
            font-size: 13px;
            color: var(--text3);
        }

        /* ── Main area ── */
        #main {
            flex: 1;
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
            background: var(--bg);
        }

        /* ── Top header ── */
        #topbar {
            height: 60px;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            padding: 0 28px;
            gap: 16px;
            flex-shrink: 0;
            z-index: 10;
        }

        .breadcrumb {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 15px;
            color: var(--text2);
            flex: 1;
            overflow: hidden;
        }

        .breadcrumb-sep {
            color: var(--border2);
        }

        .breadcrumb-current {
            color: var(--text);
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .topbar-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .btn-icon {
            width: 34px;
            height: 34px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--surface2);
            border: 1px solid var(--border);
            cursor: pointer;
            color: var(--text2);
            font-size: 15px;
            transition: all 0.15s;
        }

        .btn-icon:hover {
            background: var(--surface);
            border-color: var(--border2);
            color: var(--text);
        }

        .btn-primary {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 7px 14px;
            background: var(--accent);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.15s;
            font-family: 'DM Sans', sans-serif;
        }

        .btn-primary:hover {
            background: #1d4ed8;
        }

        /* ── Content scrollable area ── */
        #scroll-area {
            flex: 1;
            overflow-y: auto;
            padding: 32px 40px;
        }

        #content-wrap {
            max-width: 1400px;
            margin: 0;
        }

        /* ── Content transition ── */
        #content-area {
            opacity: 1;
            transform: translateY(0);
            transition: opacity 0.2s ease, transform 0.2s ease;
        }

        #content-area.fade-out {
            opacity: 0;
            transform: translateY(8px);
        }

        /* ── Prose: Light Theme ── */
        .prose {
            color: var(--text2);
            line-height: 1.75;
            font-size: 17px;
        }

        .prose h1 {
            font-family: 'Playfair Display', serif;
            font-size: 2.2rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 8px;
            letter-spacing: -0.5px;
            line-height: 1.25;
        }

        .prose h2 {
            font-size: 1.4rem;
            font-weight: 700;
            color: var(--text);
            margin-top: 2.5rem;
            margin-bottom: 0.75rem;
            padding-bottom: 8px;
            border-bottom: 2px solid var(--border);
            letter-spacing: -0.2px;
        }

        .prose h3 {
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--text);
            margin-top: 1.75rem;
            margin-bottom: 0.5rem;
        }

        .prose p {
            margin-bottom: 1rem;
        }

        .prose ul {
            list-style: disc;
            padding-left: 1.5rem;
            margin-bottom: 1rem;
        }

        .prose ol {
            list-style: decimal;
            padding-left: 1.5rem;
            margin-bottom: 1rem;
        }

        .prose li {
            margin-bottom: 0.35rem;
        }

        .prose a {
            color: var(--accent);
            text-decoration: none;
        }

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

        .prose blockquote {
            border-left: 3px solid var(--accent);
            background: var(--accent-bg);
            padding: 14px 18px;
            border-radius: 0 8px 8px 0;
            margin: 1.5rem 0;
            color: var(--text2);
            font-size: 16px;
        }

        .prose blockquote strong {
            color: var(--accent);
        }

        .prose code {
            font-family: 'DM Mono', monospace;
            background: var(--surface2);
            border: 1px solid var(--border);
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.93em;
            color: var(--accent2);
        }

        .prose pre {
            background: var(--surface);
            border: 1px solid var(--border);
            padding: 20px;
            border-radius: 10px;
            overflow-x: auto;
            margin: 1.5rem 0;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        }

        .prose pre code {
            background: transparent;
            border: none;
            padding: 0;
            color: var(--text);
            font-size: 15px;
        }

        /* ── Table styles ── */
        .prose table {
            width: 100%;
            border-collapse: collapse;
            margin: 1.5rem 0;
            font-size: 15.5px;
            border-radius: 10px;
            overflow: hidden;
            border: 1px solid var(--border);
            background: var(--surface);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        }

        .prose thead tr {
            background: var(--surface2);
        }

        .prose th {
            text-align: left;
            padding: 12px 16px;
            font-size: 13.5px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text);
            border-bottom: 1px solid var(--border2);
        }

        .prose td {
            padding: 12px 16px;
            color: var(--text);
            border-bottom: 1px solid var(--border);
            vertical-align: top;
        }

        .prose tr:last-child td {
            border-bottom: none;
        }

        .prose tbody tr:hover td {
            background: var(--bg);
        }

        /* ── Module view header card ── */
        .doc-hero {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 28px 32px;
            margin-bottom: 28px;
            display: flex;
            align-items: flex-start;
            gap: 18px;
        }

        .doc-hero-icon {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            flex-shrink: 0;
        }

        .doc-hero-body {
            flex: 1;
        }

        .doc-hero-title {
            font-family: 'Playfair Display', serif;
            font-size: 1.8rem;
            font-weight: 700;
            color: var(--text);
            line-height: 1.2;
            margin-bottom: 6px;
        }

        .doc-hero-desc {
            font-size: 16px;
            color: var(--text2);
            line-height: 1.6;
        }

        .doc-hero-tags {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            margin-top: 12px;
        }

        .tag {
            font-size: 13px;
            font-weight: 600;
            padding: 3px 9px;
            border-radius: 20px;
            font-family: 'DM Mono', monospace;
        }

        /* Section cards for outline view */
        .section-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 12px;
            margin-bottom: 28px;
        }

        .section-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 16px 18px;
            cursor: pointer;
            transition: all 0.15s;
            text-decoration: none;
            display: block;
        }

        .section-card:hover {
            border-color: var(--accent);
            box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
            transform: translateY(-1px);
        }

        .section-card-num {
            font-size: 13px;
            font-weight: 700;
            color: var(--text3);
            font-family: 'DM Mono', monospace;
            margin-bottom: 4px;
        }

        .section-card-title {
            font-size: 15.5px;
            font-weight: 600;
            color: var(--text);
            line-height: 1.3;
        }

        .section-card-arrow {
            margin-top: 8px;
            color: var(--text3);
            font-size: 13px;
            transition: color 0.15s, transform 0.15s;
            display: inline-block;
        }

        .section-card:hover .section-card-arrow {
            color: var(--accent);
            transform: translateX(3px);
        }

        /* ── Highlight.js override for light ── */
        .hljs {
            background: transparent !important;
            color: var(--text) !important;
        }

        .mobile-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.4);
            z-index: 90;
            backdrop-filter: blur(2px);
        }

        /* ── Responsive ── */
        @media (max-width: 768px) {
            #sidebar {
                position: fixed;
                left: 0;
                top: 0;
                transform: translateX(-100%);
                width: 280px !important;
                z-index: 100;
                border-right: none;
                transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            }

            #sidebar.mobile-open {
                transform: translateX(0);
                box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
            }

            .mobile-overlay.mobile-open {
                display: block;
            }

            #scroll-area {
                padding: 20px 16px;
            }

            #topbar {
                padding: 0 16px;
            }

            .doc-hero {
                flex-direction: column;
                padding: 24px 20px;
            }

            .btn-primary {
                padding: 6px 10px;
                font-size: 13px;
            }
        }

/* ── Premium List Card ── */
.premium-card {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    gap: 24px;
}

.premium-card:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.08);
    transform: translateY(-2px);
}

.premium-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: transparent;
    transition: background 0.3s;
}

.premium-card:hover::before {
    background: var(--accent);
}

.premium-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text2);
    flex-shrink: 0;
    transition: all 0.3s;
}

.premium-card:hover .premium-card-icon {
    background: var(--accent-bg);
    color: var(--accent);
}

.premium-card-body {
    flex: 1;
}

.premium-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px 0;
}

.premium-card-desc {
    font-size: 15px;
    color: var(--text2);
    margin: 0;
    line-height: 1.5;
}

.premium-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.premium-badge {
    background: var(--green-bg);
    color: var(--green);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.premium-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.premium-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface2);
    color: var(--text2);
    transition: all 0.3s;
}

.premium-card:hover .premium-action {
    background: var(--accent);
    color: #fff;
    transform: translateX(4px);
}

@media (max-width: 768px) {
    .premium-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .premium-card-meta {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
        padding-top: 16px;
        border-top: 1px dashed var(--border);
    }
}
