:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    
    /* Light theme */
    --bg-body: #f8fafc;
    --bg-header: #ffffff;
    --bg-menubar: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-code: #0f172a;
    --text-code: #e2e8f0;
    --bg-code-inline: #e2e8f0;
    --text-code-inline: #0f172a;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-primary: #4f46e5;
    --accent-hover: #4338ca;
    --accent-subtle: #eef2ff;
    --accent-text: #4338ca;
    --tag-class: #2563eb;
    --tag-interface: #059669;
    --tag-abstract: #d97706;
    --tag-enum: #7c3aed;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --bg-body: #090d16;
    --bg-header: #0f172a;
    --bg-menubar: #131d35;
    --bg-sidebar: #0f172a;
    --bg-card: #131d35;
    --bg-code: #070b14;
    --text-code: #e2e8f0;
    --bg-code-inline: #1e293b;
    --text-code-inline: #38bdf8;
    --border-color: #1e293b;
    --border-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-primary: #6366f1;
    --accent-hover: #818cf8;
    --accent-subtle: #1e1b4b;
    --accent-text: #a5b4fc;
    --tag-class: #60a5fa;
    --tag-interface: #34d399;
    --tag-abstract: #fbbf24;
    --tag-enum: #a78bfa;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* HEADER */
header.top-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    gap: 1.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.logo-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    overflow: hidden;
}

.logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.brand-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-text p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.badge-version {
    background: var(--accent-subtle);
    color: var(--accent-text);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    text-transform: uppercase;
}

.header-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.2rem;
    background: var(--bg-menubar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.header-search input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.825rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-menubar);
}

.btn-action.primary {
    background: var(--accent-primary);
    color: #ffffff;
    border-color: var(--accent-primary);
}

.theme-toggle {
    cursor: pointer;
    background: var(--bg-menubar);
    border: 1px solid var(--border-color);
    padding: 0.45rem;
    border-radius: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MENUBAR */
nav.menubar {
    background-color: var(--bg-menubar);
    border-top: 1px solid var(--border-color);
    padding: 0.35rem 1.5rem;
}

.menubar-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
}

.menubar-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
}

.menubar-item:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
}

.menubar-item.active {
    color: var(--accent-primary);
    background: var(--accent-subtle);
    font-weight: 600;
}

/* CONTENT BAR (2 SECTIONS: APP DRAWER + CONTENT AREA) */
.content-bar-wrapper {
    display: flex;
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* SECTION 1: APP DRAWER */
aside.app-drawer {
    width: 320px;
    flex-shrink: 0;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 1.25rem 1rem 3rem 1.25rem;
    overflow-y: auto;
    height: calc(100vh - 105px);
    position: sticky;
    top: 105px;
}

.drawer-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.version-select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-menubar);
    color: var(--text-primary);
    outline: none;
    font-weight: 600;
}

.drawer-search {
    margin-bottom: 1.25rem;
}

.drawer-search input {
    width: 100%;
    padding: 0.45rem 0.75rem;
    font-size: 0.825rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-menubar);
    color: var(--text-primary);
    outline: none;
}

.drawer-section {
    margin-bottom: 1.25rem;
}

.drawer-section-title {
    font-size: 0.725rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.825rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.drawer-link:hover {
    color: var(--text-primary);
    background: var(--bg-menubar);
}

.drawer-link.active {
    color: var(--accent-primary);
    background: var(--accent-subtle);
    font-weight: 600;
}

.drawer-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    margin-left: auto;
}

.badge-c { background: rgba(59, 130, 246, 0.15); color: var(--tag-class); }
.badge-i { background: rgba(16, 185, 129, 0.15); color: var(--tag-interface); }
.badge-a { background: rgba(245, 158, 11, 0.15); color: var(--tag-abstract); }

/* SECTION 2: CONTENT AREA */
main.content-area {
    flex: 1;
    padding: 2rem 3rem 4rem 3rem;
    min-width: 0;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.breadcrumbs a {
    color: inherit;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--accent-primary);
}

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

.class-package-name {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.class-title-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.class-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.class-modifiers {
    display: flex;
    gap: 0.4rem;
}

.class-desc-lead {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.doc-section {
    margin-bottom: 3rem;
}

.doc-section h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Data Tables */
.data-table-wrap {
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

table.data-table th, table.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

table.data-table th {
    background: var(--bg-menubar);
    font-weight: 600;
    color: var(--text-primary);
}

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

table.data-table tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

/* Code Blocks */
.code-window {
    background-color: var(--bg-code);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin: 1.25rem 0;
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #94a3b8;
}

pre.code-body {
    padding: 1rem 1.25rem;
    overflow-x: auto;
    color: var(--text-code);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
}

.btn-copy {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
}

/* Method Detail Box */
.method-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.method-sig {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.method-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

/* FOOTER */
footer.MantraDocs-footer {
    background-color: var(--bg-header);
    border-top: 2px solid var(--border-color);
    padding: 3rem 1.5rem 4rem 1.5rem;
    margin-top: auto;
}

.MantraDocs-container {
    max-width: 1600px;
    margin: 0 auto;
}

.MantraDocs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.package-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.package-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.package-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.package-header a {
    color: inherit;
    text-decoration: none;
}

.package-header a:hover {
    color: var(--accent-primary);
}

.class-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.class-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    background: var(--bg-menubar);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    text-decoration: none;
    color: var(--text-primary);
}

.class-item:hover {
    background: var(--accent-subtle);
    color: var(--accent-text);
}

@media (max-width: 1024px) {
    aside.app-drawer { display: none; }
    main.content-area { padding: 1.5rem; }
}