:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --panel: #ffffff;
    --text: #202433;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #1f6feb;
    --accent-soft: #eaf2ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

a {
    color: var(--accent);
}

img,
table {
    max-width: 100%;
}

table {
    border-collapse: collapse;
}

td,
th {
    padding: 6px;
}

.layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    height: 100vh;
    overflow: auto;
    border-right: 1px solid var(--border);
    background: var(--panel);
}

.brand {
    position: sticky;
    top: 0;
    z-index: 1;
    display: grid;
    gap: 2px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.brand strong {
    font-size: 18px;
}

.brand span,
.breadcrumb {
    color: var(--muted);
    font-size: 13px;
}

.search {
    position: sticky;
    top: 59px;
    z-index: 1;
    display: grid;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.search label {
    color: var(--muted);
    font-size: 13px;
}

.search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font: inherit;
}

.search-results {
    display: grid;
    gap: 4px;
    max-height: 280px;
    overflow: auto;
}

.search-results a {
    display: grid;
    gap: 2px;
    padding: 8px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}

.search-results a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.search-results span,
.empty {
    color: var(--muted);
    font-size: 12px;
}

.menu-toggle {
    appearance: none;
    -webkit-appearance: none;
    display: none;
    width: calc(100% - 40px);
    margin: 14px 20px 4px;
    padding: 12px 14px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 8px 18px rgba(31, 111, 235, 0.22);
}

.menu-toggle:focus-visible {
    outline: 3px solid rgba(31, 111, 235, 0.25);
    outline-offset: 2px;
}

.menu {
    padding: 10px 12px 24px;
}

.category {
    margin: 10px 0;
}

.category .category {
    margin-left: 14px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.category summary {
    cursor: pointer;
    list-style: none;
    margin: 0;
    padding: 9px 8px;
    border-radius: 8px;
    color: #111827;
    font-weight: 700;
    font-size: 14px;
}

.category summary::-webkit-details-marker {
    display: none;
}

.category summary::before {
    content: "+";
    display: inline-block;
    width: 18px;
    color: var(--muted);
}

.category[open] > summary {
    background: #f3f4f6;
}

.category[open] > summary::before {
    content: "-";
}

.category-body {
    padding-top: 4px;
}

.content-link {
    display: block;
    margin: 2px 0;
    padding: 8px;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
}

.content-link:hover,
.content-link.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.viewer {
    min-width: 0;
}

.viewer iframe {
    display: block;
    width: 100%;
    height: 100vh;
    border: 0;
    background: var(--panel);
}

.page {
    background: var(--panel);
}

.article {
    max-width: 980px;
    margin: 0 auto;
    padding: 36px 40px 64px;
}

.article h1 {
    margin: 0 0 24px;
    font-size: 30px;
    line-height: 1.2;
}

.content {
    overflow-wrap: anywhere;
}

.content table {
    display: block;
    overflow-x: auto;
}

@media (max-width: 860px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .brand,
    .search {
        position: static;
    }

    .menu-toggle {
        display: block;
    }

    .menu {
        display: none;
        max-height: min(55vh, 520px);
        overflow: auto;
        margin: 12px 20px 18px;
        padding: 8px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--panel);
        box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
    }

    .layout.menu-open .menu {
        display: block;
    }

    .viewer iframe {
        height: calc(100vh - 235px);
        min-height: 420px;
    }

    .article {
        padding: 24px 18px 44px;
    }
}
