:root {
    --bg: #f3f5f7;
    --paper: #ffffff;
    --ink: #1c2430;
    --muted: #5c6b7a;
    --line: #d7dee6;
    --sidebar: #172033;
    --sidebar-ink: #e7edf4;
    --sidebar-muted: #93a4b8;
    --accent: #0f6e6b;
    --topbar-h: 3.5rem;
    --sidebar-w: 18rem;
    --get: #0c7a45;
    --post: #1d4e89;
    --put: #8a5a00;
    --patch: #6b3fa0;
    --delete: #a12626;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}

body {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

button, input, select { font: inherit; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--topbar-h);
    padding: 0.4rem 1rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.base-url {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.92rem;
}

.version-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    color: var(--muted);
    font-size: 0.92rem;
}

.version-filter select {
    min-height: 2.75rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--paper);
    color: var(--ink);
}

.menu-btn,
.backdrop { display: none; }

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
}

.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-ink);
    padding: 0.75rem 0 1.5rem;
    min-height: 0;
    overflow: auto;
}

.nav-group { margin: 0 0 0.35rem; }

.nav-page,
.nav-endpoint {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.45rem 1rem;
    color: var(--sidebar-ink);
    text-decoration: none;
}

.nav-page { font-weight: 650; }

.nav-group.is-active > .nav-page,
.nav-page.is-active { background: rgba(255, 255, 255, 0.08); color: white; }

.nav-endpoint {
    gap: 0.45rem;
    color: var(--sidebar-muted);
    font-size: 0.92rem;
    padding-left: 1rem;
}

.nav-endpoint .method {
    flex: 0 0 auto;
    justify-content: center;
    min-width: 3.15rem;
    min-height: 1.25rem;
    font-size: 0.65rem;
}

.nav-endpoint .nav-path {
    min-width: 0;
    margin-left: 2px;
}

.nav-page:hover,
.nav-endpoint:hover,
.nav-endpoint.is-active { background: rgba(255, 255, 255, 0.08); color: white; }

.nav-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.content {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 1.25rem 1.5rem 3rem;
}

.doc-page h2,
.endpoint h2,
.doc-section h2 {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
}

.endpoint h2 .path {
    min-width: 0;
}

.endpoint,
.doc-section {
    scroll-margin-top: 0.75rem;
    margin: 0 0 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}

.method {
    display: inline-flex;
    align-items: center;
    min-height: 1.6rem;
    padding: 0 0.45rem;
    border-radius: 0.35rem;
    color: white;
    background: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.method-get { background: var(--get); }
.method-post { background: var(--post); }
.method-put { background: var(--put); }
.method-patch { background: var(--patch); }
.method-delete { background: var(--delete); }

.req {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    min-height: 1.25rem;
    padding: 0 0.4rem;
    border-radius: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.req-yes {
    color: white;
    background: var(--get);
}

.req-no {
    color: var(--muted);
    background: #e7eef3;
}

.path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.endpoint-version {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.8rem 0 1rem;
}

table {
    width: 100%;
    min-width: 36rem;
    table-layout: fixed;
    border-collapse: collapse;
    background: var(--paper);
    font-size: 0.95rem;
}

table.cols-2 th:nth-child(1) { width: 34%; }
table.cols-3 th:nth-child(1) { width: 32%; }
table.cols-3 th:nth-child(2) { width: 16%; }
table.cols-4 th:nth-child(1) { width: 28%; }
table.cols-4 th:nth-child(2) { width: 14%; }
table.cols-4 th:nth-child(3) { width: 12%; }

th, td {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
}

td.field-nest {
    padding-left: calc(0.7rem + var(--depth) * 1.15rem);
}

th { background: #eef2f6; }

pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.8rem 0 1rem;
    padding: 0.9rem 1rem;
    border-radius: 0.6rem;
    background: #142033;
    color: #e7edf4;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
}

p code {
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    background: #e7eef3;
    color: var(--ink);
}

.allowed,
.default-value,
.desc-text {
    display: block;
}

.allowed,
.default-value {
    color: var(--muted);
}

.desc-text + .default-value,
.allowed + .default-value {
    margin-top: 0.2rem;
}

td .allowed code,
td .default-value code {
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    background: #fde8ea;
    color: #e03131;
    font-size: 0.86em;
}

.empty-version { color: var(--muted); }

[hidden] { display: none !important; }

@media (max-width: 800px) {
    .menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2.75rem;
        min-height: 2.75rem;
        border: 1px solid var(--line);
        border-radius: 0.5rem;
        background: var(--paper);
    }

    .version-filter {
        margin-left: 0;
        flex: 1 1 10rem;
    }

    .version-filter span { display: none; }

    .base-url { display: none; }

    .layout {
        display: block;
        overflow: auto;
    }

    .content { overflow: visible; }

    .sidebar {
        position: fixed;
        z-index: 40;
        top: var(--topbar-h);
        bottom: 0;
        left: 0;
        width: min(var(--sidebar-w), 86vw);
        overflow: auto;
        transform: translateX(-105%);
        transition: transform 0.18s ease;
    }

    .sidebar.is-open { transform: none; }

    .backdrop {
        display: block;
        position: fixed;
        z-index: 35;
        inset: var(--topbar-h) 0 0 0;
        border: 0;
        background: rgba(23, 32, 51, 0.45);
    }

    .content { padding: 1rem 0.9rem 2.5rem; }

    .topbar { flex-wrap: wrap; }
}
