:root {
    --ds-bg: #f8f9fa;
    --ds-surface: #ffffff;
    --ds-sidebar: #f8f9fa;
    --ds-surface-muted: #f8fafc;
    --ds-text: #2c3e50;
    --ds-text-strong: #1e293b;
    --ds-text-muted: #5b6e8c;
    --ds-border: #dfe6f1;
    --ds-primary: #2563eb;
    --ds-primary-hover: #1d4ed8;
    --ds-primary-soft: #eaf2ff;
    --ds-danger: #dc2626;
    --ds-header-height: 60px;
    --ds-sidebar-width: 260px;
    --ds-toc-width: 250px;
    --ds-footer-bg: #161e26;
}

[data-theme="dark"] {
    --ds-bg: #0f172a;
    --ds-surface: #0f172a;
    --ds-sidebar: #111827;
    --ds-surface-muted: #111827;
    --ds-text: #cbd5e1;
    --ds-text-strong: #e5e7eb;
    --ds-text-muted: #9ca3af;
    --ds-border: #334155;
    --ds-primary: #93c5fd;
    --ds-primary-hover: #bfdbfe;
    --ds-primary-soft: rgba(91, 106, 191, 0.2);
    --ds-footer-bg: #111827;
}

html {
    height: auto !important;
    min-width: 320px;
    min-height: 100%;
    overflow-y: auto !important;
    color-scheme: light;
    scroll-behavior: smooth;
}

html[data-theme="dark"] { color-scheme: dark; }

body.docspace-page {
    display: flex;
    min-width: 320px;
    min-height: 100vh;
    height: auto !important;
    margin: 0;
    padding: 0 !important;
    overflow-y: visible !important;
    flex-direction: column;
    background: var(--ds-bg);
    color: var(--ds-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    transition: background-color 0.25s ease, color 0.25s ease;
}

body.docspace-panel-open { overflow: hidden; }

body.docspace-page *,
body.docspace-page *::before,
body.docspace-page *::after { box-sizing: border-box; }

body.docspace-page a {
    color: var(--ds-primary);
    text-decoration: none;
}

body.docspace-page a:hover { color: var(--ds-primary-hover); }

body.docspace-page button,
body.docspace-page input,
body.docspace-page textarea,
body.docspace-page select { font: inherit; }

body.docspace-page button { cursor: pointer; }

body.docspace-page a:focus-visible,
body.docspace-page button:focus-visible,
body.docspace-page input:focus-visible,
body.docspace-page textarea:focus-visible,
body.docspace-page select:focus-visible,
body.docspace-page [tabindex]:focus-visible {
    outline: 3px solid var(--ds-primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sr-only-focusable:focus {
    position: fixed !important;
    z-index: 2000;
    top: 8px;
    left: 8px;
    width: auto !important;
    height: auto !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    background: var(--ds-surface);
    color: var(--ds-text);
}

.docspace-header {
    position: fixed;
    z-index: 1200;
    inset: 0 0 auto;
    height: var(--ds-header-height);
    border-bottom: 1px solid var(--ds-border);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .docspace-header { background: rgba(17, 24, 39, 0.96); }

.docspace-header__inner {
    display: flex;
    width: 100%;
    height: 60px;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.docspace-header__left,
.docspace-header__actions {
    display: flex;
    align-items: center;
}

.docspace-header__left { gap: 12px; }
.docspace-header__actions { gap: 10px; white-space: nowrap; }

.docspace-brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: var(--ds-text-strong) !important;
    font-weight: 700;
    white-space: nowrap;
}

.docspace-brand > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.docspace-brand__icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.docspace-brand__icon img { width: 16px; height: 16px; }

.docspace-project-nav {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.docspace-project-nav::-webkit-scrollbar { display: none; }
.docspace-project-nav__head { display: none; }

.docspace-project-nav__item {
    display: inline-flex;
    height: 32px;
    padding: 0 14px;
    flex: 0 0 auto;
    align-items: center;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--ds-text-muted) !important;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.docspace-project-nav__item:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--ds-primary) !important;
}

.docspace-project-nav__item.is-active {
    border-bottom-color: #2563eb;
    color: #2563eb !important;
}

[data-theme="dark"] .docspace-project-nav__item.is-active { color: #60a5fa !important; }

.docspace-header__button {
    display: inline-flex;
    height: 34px;
    padding: 0 14px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: var(--ds-surface);
    color: #2563eb !important;
    font-weight: 600;
}

.docspace-header__button:hover { background: var(--ds-primary-soft); }

.docspace-mobile-menu,
.docspace-project-toggle,
.docspace-project-nav__close {
    display: none;
    padding: 4px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
}

.docspace-page-shell {
    display: flex;
    min-height: calc(100vh - var(--ds-header-height));
    margin-top: var(--ds-header-height);
    flex: 1 0 auto;
    flex-direction: column;
}

.docspace-reader {
    display: grid;
    min-width: 0;
    min-height: calc(100vh - var(--ds-header-height) - 72px);
    padding-left: 20px;
    margin: 0;
    flex: 1 0 auto;
    grid-template-columns: var(--ds-sidebar-width) minmax(0, 1fr) var(--ds-toc-width);
    background: var(--ds-bg);
}

.docspace-sidebar,
.docspace-toc {
    position: sticky;
    top: var(--ds-header-height);
    min-width: 0;
    min-height: calc(100vh - var(--ds-header-height) - 72px);
    height: auto;
    max-height: calc(100vh - var(--ds-header-height));
    align-self: stretch;
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--ds-sidebar);
}

.docspace-sidebar { padding: 20px 0 16px; }
.docspace-toc { padding: 24px 16px 12px 20px; }

.docspace-sidebar__head { display: none; }

.docspace-sidebar__search { margin: 20px 0; }

.docspace-sidebar__search input {
    width: 90%;
    height: 40px;
    padding: 0 15px;
    border: 2px solid #eeeeee;
    border-radius: 10px;
    outline: 0;
    background: var(--ds-surface);
    color: var(--ds-text);
    font-size: 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.docspace-sidebar__search input::placeholder { color: #9ca3af; }

body.docspace-page .docspace-sidebar__search input:focus {
    border-color: #7c8ae6;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.1);
}

[data-theme="dark"] .docspace-sidebar__search input {
    border-color: #334155;
    background: #0b1222;
}

.docspace-tree {
    margin: 0;
    padding: 0;
    list-style: none;
}

.docspace-tree__item { margin: 0; }
.docspace-tree__item[hidden] { display: none; }

.docspace-tree__item > a,
.docspace-tree__directory {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 8px 20px 8px calc(20px + var(--ds-depth, 0) * 20px);
    align-items: center;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #6b7280 !important;
    font-size: 13px;
    line-height: 1.7;
    text-align: left;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.docspace-tree__item > a > span,
.docspace-tree__directory > span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docspace-tree__item > a:hover,
.docspace-tree__directory:hover {
    background: rgba(91, 106, 191, 0.04);
    color: #5b6abf !important;
}

.docspace-tree__item.is-active > a {
    border-left-color: #2563eb;
    background: #eaf2ff;
    color: #2563eb !important;
    font-weight: 600;
}

[data-theme="dark"] .docspace-tree__item > a,
[data-theme="dark"] .docspace-tree__directory { color: #9ca3af !important; }

[data-theme="dark"] .docspace-tree__item.is-active > a {
    background: rgba(91, 106, 191, 0.2);
    color: #c7d2fe !important;
}

.docspace-tree__chevron {
    width: 16px;
    height: 16px;
    margin-left: 6px;
    flex: 0 0 16px;
    opacity: 0.75;
    transition: transform 0.2s ease;
}

.docspace-tree__directory[aria-expanded="true"] .docspace-tree__chevron { transform: rotate(90deg); }

.docspace-tree__permission-icon {
    width: 16px;
    height: 16px;
    margin-right: 7px;
    flex: 0 0 16px;
}

.docspace-content {
    width: 100%;
    min-width: 0;
    min-height: calc(100vh - var(--ds-header-height) - 72px);
    padding: 40px 30px 60px;
    overflow-x: hidden;
    border-right: 1px solid rgba(223, 230, 241, 0.55);
    border-left: 1px solid rgba(223, 230, 241, 0.55);
    background: var(--ds-surface);
}

@media (min-width: 993px) {
    body.docspace-page--reader {
        min-height: 0;
        height: 100vh !important;
        overflow: hidden !important;
    }

    .docspace-page--reader .docspace-page-shell {
        height: calc(100vh - var(--ds-header-height));
        min-height: 0;
        flex: 0 0 auto;
        overflow: hidden;
    }

    .docspace-page--reader .docspace-reader {
        height: 100%;
        min-height: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .docspace-page--reader .docspace-sidebar,
    .docspace-page--reader .docspace-toc {
        position: relative;
        top: auto;
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .docspace-page--reader .docspace-content {
        height: 100%;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        scrollbar-gutter: stable;
    }

    .docspace-page--reader .docspace-footer { display: none; }
}

[data-theme="dark"] .docspace-content { border-color: #1f2937; }

.docspace-document__header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--ds-border);
}

.docspace-document__header h1 {
    margin: 0;
    color: var(--ds-text-strong);
    font-size: 28px;
    font-weight: 600;
    line-height: 1.35;
}

.docspace-document__meta {
    display: flex;
    margin: 8px 0 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--ds-text-muted);
    font-size: 13px;
}

.docspace-document__meta > span:first-child {
    min-width: 0;
    flex: 1 1 280px;
}

.docspace-document__tag {
    padding: 4px 12px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 10px;
    background: var(--ds-primary-soft);
    color: var(--ds-primary);
    font-size: 12px;
    font-weight: 600;
}

.docspace-access-body {
    min-height: 420px;
    color: var(--ds-text);
    font-size: 15px;
    line-height: 1.7;
}

.docspace-access-card {
    width: min(100%, 520px);
    margin: 24px auto;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: var(--ds-surface-muted);
}

.docspace-access-body.docspace-markdown > .docspace-access-card { margin-top: 24px; }

.docspace-access-card--password { padding: 20px; }
.docspace-access-card--login { padding: 30px 20px; text-align: center; }

.docspace-access-body .docspace-access-card h3 {
    margin: 0 0 10px;
    border: 0;
    color: var(--ds-text-strong);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.docspace-access-body .docspace-access-card--login p {
    margin: 10px 0;
    color: var(--ds-text);
    text-align: center;
}

.docspace-access-body .docspace-access-lock {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
    border: 0;
}

.docspace-access-tip {
    margin-bottom: 14px;
    padding: 8px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
    background: var(--ds-primary-soft);
    color: #1d4ed8;
    font-size: 13px;
}

.docspace-access-tip.is-error {
    border-color: rgba(220, 38, 38, 0.28);
    background: rgba(220, 38, 38, 0.08);
    color: var(--ds-danger);
}

.docspace-access-form-row { display: flex; gap: 10px; }

.docspace-access-form-row .form-control {
    min-width: 0;
    height: 38px;
    padding: 8px 10px;
    flex: 1;
    border: 1px solid #d2d6de;
    border-radius: 8px;
    outline: 0;
    background: var(--ds-surface);
    color: var(--ds-text);
}

.docspace-access-form-row .form-control:focus {
    border-color: #7c8ae6;
    box-shadow: 0 0 0 3px rgba(91, 106, 191, 0.1);
}

.docspace-access-form-row .btn-primary {
    height: 38px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.26);
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
}

.docspace-access-form-row .btn-primary:disabled { cursor: wait; opacity: 0.72; }
.docspace-form-status:empty { display: none; }

[data-theme="dark"] .docspace-access-form-row .form-control {
    border-color: #334155;
    background: #0b1222;
}

[data-theme="dark"] .docspace-access-tip {
    border-color: rgba(96, 165, 250, 0.35);
    background: rgba(30, 58, 138, 0.35);
    color: #93c5fd;
}

[data-theme="dark"] .docspace-access-tip.is-error {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(127, 29, 29, 0.4);
    color: #fca5a5;
}

.docspace-document-nav {
    display: flex;
    margin-top: 36px;
    padding-top: 20px;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--ds-border);
}

.docspace-document-nav a:last-child { margin-left: auto; text-align: right; }

.docspace-toc__title {
    margin: 0 0 5px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.2px;
}

.docspace-toc ol {
    margin: 0;
    padding: 0 0 0 10px;
    overflow: hidden;
    list-style: none;
}

.docspace-toc li { margin: 0; padding: 3px 0; }
.docspace-toc li[class$="-3"] { padding-left: 10px; }
.docspace-toc li[class$="-4"] { padding-left: 20px; }
.docspace-toc li[class$="-5"],
.docspace-toc li[class$="-6"] { padding-left: 28px; }

.docspace-toc a {
    display: block;
    padding-left: 10px;
    border-left: 2px solid #eeeeee;
    color: var(--ds-text-muted) !important;
    font-size: 13px;
    line-height: 1.7;
}

.docspace-toc a:hover,
.docspace-toc a.is-active {
    border-left-color: #2563eb;
    color: #2563eb !important;
    font-weight: 700;
}

[data-theme="dark"] .docspace-toc a { border-left-color: #334155; }
[data-theme="dark"] .docspace-toc a.is-active { border-left-color: #60a5fa; color: #c7d2fe !important; }

.docspace-floating {
    position: fixed;
    z-index: 1200;
    right: 20px;
    bottom: 84px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.docspace-floating__button {
    display: flex;
    width: 42px;
    height: 42px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    background: var(--ds-surface);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.docspace-floating__button:hover {
    transform: translateY(-1px);
    border-color: #bfd0ff;
    background: var(--ds-primary-soft);
}

.docspace-floating__button img { width: 20px; height: 20px; }

[data-theme="dark"] .docspace-floating__button img,
[data-theme="dark"] .docspace-mobile-menu img,
[data-theme="dark"] .docspace-project-toggle img { filter: invert(88%) sepia(8%) saturate(454%) hue-rotate(176deg) brightness(96%); }

.docspace-footer {
    display: flex;
    min-height: 72px;
    padding: 20px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-top: 1px solid #2a2a3e;
    background: var(--ds-footer-bg);
    text-align: center;
}

.docspace-footer p { margin: 0; color: #aaaaaa; }
.docspace-footer a { color: #aaaaaa !important; }
.docspace-footer a:hover { color: #e2e8f0 !important; }

.docspace-overlay {
    display: none;
    position: fixed;
    z-index: 1190;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.45);
}

.docspace-overlay[hidden] { display: none !important; }

.docspace-content--standalone {
    width: min(100%, 1240px);
    min-height: calc(100vh - var(--ds-header-height) - 72px);
    margin: 0 auto;
    padding: 44px 28px 64px;
    border: 0;
    background: transparent;
}

.docspace-home__hero {
    margin-bottom: 40px;
    padding: 38px 30px;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: var(--ds-surface);
    text-align: center;
}

.docspace-home__hero h1,
.docspace-project-page h1,
.docspace-search h1,
.docspace-account h1,
.docspace-error h1 {
    margin: 0 0 8px;
    color: var(--ds-text-strong);
    font-size: 28px;
    line-height: 1.35;
}

.docspace-home__hero p { margin: 0 0 20px; color: var(--ds-text-muted); }

.docspace-search-form {
    display: flex;
    max-width: 680px;
    margin: 0 auto;
    gap: 10px;
}

.docspace-search-form input,
.docspace-search-form__controls input,
.docspace-auth-card .form-control,
.docspace-account-form .form-control {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #d2d6de;
    border-radius: 8px;
    background: var(--ds-surface);
    color: var(--ds-text);
}

.docspace-search-form button,
.docspace-search-form__controls button,
.docspace-auth-card .btn-primary,
.docspace-account .btn-primary {
    min-height: 42px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
}

.docspace-project-grid {
    display: grid;
    margin: 16px 0 36px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.docspace-project-card,
.docspace-recent-list li,
.docspace-search-results article,
.docspace-account > section {
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: var(--ds-surface);
}

.docspace-project-card { padding: 18px; }
.docspace-project-card h3 { margin: 0 0 8px; font-size: 17px; }
.docspace-project-card p { margin: 0; color: var(--ds-text-muted); }

.docspace-recent-list,
.docspace-search-results {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.docspace-recent-list li {
    display: grid;
    margin-bottom: 10px;
    padding: 13px 16px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
}

.docspace-recent-list span,
.docspace-recent-list time { color: var(--ds-text-muted); }

.docspace-search > header { margin-bottom: 20px; }
.docspace-search > header p { color: var(--ds-text-muted); }

.docspace-search-form__controls {
    display: flex;
    margin: 6px 0;
    gap: 8px;
}

.docspace-search-results li { margin-bottom: 12px; }
.docspace-search-results article { padding: 16px 18px; }
.docspace-search-results h2 { margin: 0 0 6px; font-size: 18px; }
.docspace-search-results p { margin: 0 0 8px; }
.docspace-search-results small { color: var(--ds-text-muted); }
.docspace-search mark { padding: 0 2px; background: #fef08a; color: #713f12; }

.docspace-auth {
    display: flex;
    min-height: min(620px, calc(100vh - 176px));
    padding: 36px 16px;
    align-items: flex-start;
    justify-content: center;
}

.docspace-auth-card {
    width: min(100%, 520px);
    margin-top: 50px;
    padding: 24px 20px;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: var(--ds-surface-muted);
}

.docspace-auth-card h1 {
    margin: 0 0 8px;
    color: var(--ds-text-strong);
    font-size: 20px;
    text-align: center;
}

.docspace-auth-card > p { margin: 0 0 18px; color: var(--ds-text-muted); text-align: center; }
.docspace-auth-card .form-group { margin-bottom: 14px; }
.docspace-auth-card label { display: block; margin-bottom: 5px; font-weight: 600; }
.docspace-auth-card .checkbox label { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; }
.docspace-auth-card .btn-block { width: 100%; }
.docspace-form-status { margin: 12px 0 0; color: var(--ds-text-muted); }

.docspace-account { max-width: 900px; margin: 0 auto; }
.docspace-account > section { margin-top: 18px; padding: 22px; }
.docspace-account h2 { margin-top: 0; font-size: 20px; }
.docspace-account-form .form-group { margin-bottom: 15px; }
.docspace-account-form label { display: block; margin-bottom: 5px; font-weight: 600; }
.docspace-account-form textarea { min-height: 100px; resize: vertical; }
.docspace-logout-form { margin-top: 18px; }

.docspace-alert,
.alert {
    padding: 10px 12px;
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.08);
    color: var(--ds-danger);
}

.docspace-empty { color: var(--ds-text-muted); }

.docspace-error {
    max-width: 620px;
    margin: 80px auto;
    padding: 30px;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    background: var(--ds-surface);
    text-align: center;
}

@media (max-width: 1200px) {
    .docspace-reader {
        grid-template-columns: 280px minmax(0, 1fr);
    }

    .docspace-toc { display: none; }
    .docspace-project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
    html,
    body.docspace-page { max-width: 100vw; overflow-x: hidden; }

    .docspace-header__inner { gap: 10px; }
    .docspace-header__left { min-width: 0; gap: 8px; }
    .docspace-mobile-menu,
    .docspace-project-toggle { display: inline-flex; width: 36px; height: 44px; flex: 0 0 36px; }
    .docspace-mobile-menu img { width: 26px; height: 26px; }
    .docspace-project-toggle img { width: 24px; height: 24px; }
    .docspace-header__button { height: 32px; padding: 0 10px; }

    .docspace-project-nav {
        position: fixed;
        z-index: 1202;
        top: var(--ds-header-height);
        right: 0;
        display: flex;
        width: 78%;
        max-width: 320px;
        height: calc(100vh - var(--ds-header-height));
        padding: 12px 10px;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 6px;
        overflow: auto;
        border-left: 1px solid var(--ds-border);
        background: var(--ds-surface);
        box-shadow: -10px 0 24px rgba(0, 0, 0, 0.16);
        transform: translateX(110%);
        transition: transform 0.25s ease;
    }

    .docspace-project-nav.is-open { transform: translateX(0); }

    .docspace-project-nav__head {
        display: flex;
        padding: 2px 6px 10px;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--ds-border);
        color: var(--ds-text-strong);
        font-weight: 600;
    }

    .docspace-project-nav__close {
        display: inline-flex;
        width: 36px;
        height: 36px;
    }

    .docspace-project-nav__item {
        height: 38px;
        border-bottom: 0;
        border-radius: 10px;
    }

    .docspace-reader {
        display: grid;
        min-height: auto;
        padding: 0;
        grid-template-columns: minmax(0, 1fr);
        background: var(--ds-surface);
    }

    .docspace-sidebar {
        position: fixed;
        z-index: 1201;
        top: var(--ds-header-height);
        left: 0;
        width: 84%;
        max-width: 320px;
        height: calc(100vh - var(--ds-header-height));
        max-height: none;
        padding-top: 10px;
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
        transform: translateX(-110%);
        transition: transform 0.25s ease;
    }

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

    .docspace-sidebar__head {
        display: flex;
        height: 42px;
        padding: 0 6px;
        align-items: center;
    }

    .docspace-sidebar__close {
        display: inline-flex;
        width: 40px;
        height: 40px;
        padding: 8px;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 8px;
        background: transparent;
    }

    .docspace-sidebar__search input { margin-left: 15px; }
    .docspace-overlay.is-visible { display: block; }

    .docspace-content {
        min-height: auto;
        padding: 16px 16px 24px;
        border: 0;
        overflow-x: hidden;
    }

    .docspace-document__header h1 { font-size: 22px; }
    .docspace-content--standalone { padding: 28px 16px 48px; }
    .docspace-floating { right: 20px; bottom: 84px; }
    .docspace-footer { min-height: 72px; }
}

@media (max-width: 600px) {
    .docspace-brand { gap: 8px; }
    .docspace-brand__icon { width: 30px; flex-basis: 30px; }
    .docspace-header__actions { gap: 4px; }
    .docspace-document__meta { gap: 7px; }
    .docspace-document-nav { flex-direction: column; }
    .docspace-document-nav a:last-child { margin-left: 0; text-align: left; }
    .docspace-project-grid { grid-template-columns: minmax(0, 1fr); }
    .docspace-recent-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .docspace-search-form,
    .docspace-search-form__controls { flex-wrap: wrap; }
    .docspace-search-form input,
    .docspace-search-form__controls input { flex: 1 0 100%; }
    .docspace-auth { padding: 12px 0; }
    .docspace-auth-card { margin-top: 18px; }
}
