:root {
    --bg: #f5f7fb;
    --bg-alt: #eef1f8;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --primary: #1f3a8a;
    --primary-600: #1d4ed8;
    --accent: #0f766e;
    --accent-soft: rgba(15, 118, 110, 0.12);
    --border: #e2e8f0;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Work Sans', sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top, #eaf1ff 0%, var(--bg) 45%, #f8fafc 100%);
    font-size: 16px;
    overflow-x: hidden;
}

body.nav-open {
    overflow: hidden;
}

.page {
    max-width: 1560px;
    width: min(1560px, 96vw);
    margin: 28px auto 70px;
    padding: 0 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 30px;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.2em;
    color: var(--muted);
    margin: 0 0 8px;
}

h1,
h2,
h3,
h4 {
    font-family: 'Sora', sans-serif;
    margin: 0 0 12px;
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 30px;
}

h3 {
    font-size: 24px;
}

h4 {
    font-size: 18px;
}

p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.6;
}

.lead {
    font-size: 18px;
    color: #1f2937;
}

.section-header {
    margin-bottom: 18px;
}

.section-lead {
    font-size: 16px;
    color: #334155;
}

.pill {
    background: #eef2ff;
    color: #312e81;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 22px;
}

.sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
}

.sidebar-inner {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 22px;
    border: 1px solid var(--border);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5f5 transparent;
}

.sidebar-inner::-webkit-scrollbar {
    width: 8px;
}

.sidebar-inner::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-inner::-webkit-scrollbar-thumb {
    background: #cbd5f5;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sidebar-inner::-webkit-scrollbar-thumb:hover {
    background: #a5b4fc;
    background-clip: padding-box;
}

.brand {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    font-weight: 600;
}

.nav-toggle span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-button {
    border: none;
    background: #ffffff;
    color: #0f172a;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.nav-backdrop {
    display: none;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nav-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #94a3b8;
    margin: 0 0 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1e293b;
    padding: 12px 14px;
    border-radius: 12px;
    transition: 0.2s ease;
    font-size: 15px;
}

.nav-link:hover {
    background: #f1f5f9;
}

.nav-link.active {
    background: #111827;
    color: #fff;
}

.nav-icon {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #94a3b8;
    flex-shrink: 0;
}

.nav-link.active .nav-icon {
    background: #ffffff;
}

.nav-subgroup {
    margin-left: 18px;
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

.nav-sublink {
    text-decoration: none;
    color: #334155;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    transition: 0.2s ease;
}

.nav-sublink:hover {
    background: #f1f5f9;
}

.nav-sublink.active {
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 600;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.panel {
    scroll-margin-top: 100px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    border: 1px solid var(--border);
}

.hero {
    display: grid;
    grid-template-columns: 1.6fr 0.4fr;
    gap: 20px;
    align-items: center;
}

.hero-badge {
    background: linear-gradient(145deg, var(--primary) 0%, #0f172a 100%);
    color: #fff;
    padding: 18px;
    border-radius: 16px;
    text-align: center;
}

.hero-badge span {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.7);
}

.meta-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.meta-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 6px;
}

.meta-value {
    font-weight: 600;
    color: #1e293b;
}

.feature {
    display: grid;
    gap: 20px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.feature-card {
    background: var(--bg-alt);
    padding: 18px;
    border-radius: 16px;
}

.steps {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.step {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 16px;
    align-items: start;
    background: #f8fafc;
    padding: 18px;
    border-radius: 16px;
}

.step span {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 600;
}

.flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.flow-step {
    background: #f8fafc;
    border-radius: 16px;
    padding: 16px;
    border: 1px dashed #cbd5f5;
}

.flow-number {
    display: inline-flex;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 12px;
}

.env-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.env-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
}

.muted {
    color: #94a3b8;
}

.note {
    background: #0f172a;
    color: #fff;
    padding: 20px;
    border-radius: 16px;
    margin-top: 22px;
}

.note p {
    color: rgba(255, 255, 255, 0.7);
}

.callout {
    background: #0f172a;
    color: #fff;
    padding: 18px;
    border-radius: 16px;
    margin-top: 20px;
}

.callout h4 {
    margin-bottom: 8px;
    color: #fff;
}

.callout p {
    color: rgba(255, 255, 255, 0.7);
}

.callout.light {
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid var(--border);
}

.callout.light h4 {
    color: #0f172a;
}

.callout.light .spec-value {
    color: #475569;
}

.code-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 22px;
}

pre {
    background: #0b1120;
    color: #e2e8f0;
    padding: 18px;
    border-radius: 16px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.5;
    max-width: 100%;
}

code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.hint {
    margin-top: 18px;
    background: #f1f5f9;
    padding: 14px 18px;
    border-radius: 14px;
    color: #334155;
    font-size: 14px;
}

.event-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.event-list span {
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    color: #1f2937;
}

.table {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.table .row {
    display: grid;
    grid-template-columns: 1.4fr 0.5fr 1.4fr;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f8fafc;
    font-size: 15px;
}

.table .row.header {
    background: #111827;
    color: #fff;
    font-weight: 600;
}

.error-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.error-card {
    background: #fff1f2;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid #fecdd3;
}

.error-card h4 {
    margin-bottom: 6px;
    color: #9f1239;
}

.endpoint-list {
    display: grid;
    gap: 20px;
    margin-top: 22px;
}

.api-groups {
    display: grid;
    gap: 32px;
    margin-top: 22px;
}

.group-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.group-chip {
    padding: 8px 14px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #1e293b;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s ease;
}

.group-chip:hover {
    background: #cbd5f5;
}

.group-section {
    scroll-margin-top: 120px;
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.endpoint {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
}

.endpoint-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.endpoint-tag {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.endpoint-title {
    font-weight: 600;
    color: #0f172a;
}

.endpoint-path {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
    color: #0f172a;
}

.endpoint-desc {
    margin-bottom: 14px;
}

.endpoint-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.meta-pill {
    padding: 6px 12px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0c4a6e;
    font-size: 12px;
    font-weight: 600;
}

.endpoint-note {
    margin-top: 12px;
    color: #475569;
    font-size: 13px;
}

.method {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.12em;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
}

.method.post {
    background: #dbeafe;
    color: #1d4ed8;
}

.method.get {
    background: #dcfce7;
    color: #166534;
}

.endpoint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.endpoint-block {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px;
    border: 1px solid #e2e8f0;
}

.spec-list {
    display: grid;
    gap: 10px;
}

.spec-item {
    display: grid;
    gap: 4px;
}

.spec-key {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    font-weight: 600;
}

.spec-value {
    font-size: 14px;
    color: #334155;
}

.schema-details {
    margin-top: 12px;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
}

.schema-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
}

.schema-table {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.schema-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.6fr 1.6fr;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 13px;
    color: #0f172a;
}

.schema-row.header {
    background: #0f172a;
    color: #fff;
    font-weight: 600;
}

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

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .meta-row {
        grid-template-columns: 1fr;
    }

    .endpoint {
        padding: 18px;
    }

    .group-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .sidebar-inner {
        padding: 0;
        border-radius: 0;
        border: none;
        box-shadow: none;
        background: transparent;
        max-height: none;
        overflow: visible;
    }

    .brand {
        display: none;
    }

    .nav-toggle {
        display: grid;
        grid-template-columns: 1fr auto;
        margin: 0 0 8px;
    }

    .nav {
        position: fixed;
        top: 72px;
        left: 12px;
        right: 12px;
        background: #ffffff;
        border-radius: 18px;
        padding: 14px 12px;
        box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        display: none;
        z-index: 25;
    }

    .nav-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.35);
        display: none;
        z-index: 15;
    }

    body.nav-open .nav {
        display: block;
    }

    body.nav-open .nav-backdrop {
        display: block;
    }
}

@media (max-width: 640px) {
    .page {
        width: 100%;
        margin: 18px auto 50px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .table .row {
        grid-template-columns: 1fr;
    }

    .schema-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1400px) {
    .layout {
        grid-template-columns: 300px minmax(0, 1fr);
        gap: 26px;
    }

    .card {
        padding: 36px;
    }
}
