/* Developer API reference of the external AI-agent API (/api/agent/reference).
   Three panes like a classic OpenAPI reference: navigation, documentation and
   a dark sample panel. */
:root {
    --ref-text: #1f2937;
    --ref-muted: #5b6577;
    --ref-border: #e3e8f0;
    --ref-accent: #2f55d4;
    --ref-soft: #eef3ff;
    --ref-bg: #ffffff;
    --ref-nav-bg: #f7f9fc;
    --ref-code-bg: #f3f6fa;
    --ref-panel: #263142;
    --ref-panel-2: #1c2533;
    --ref-panel-text: #e6e9ef;
    --ref-panel-muted: #9aa5b8;
    --ref-panel-border: #354157;
    --ref-get: #2f9e5b;
    --ref-post: #2f55d4;
    --ref-patch: #b7791f;
    --ref-delete: #c53030;
    --ref-ok: #2f9e5b;
    --ref-err: #c53030;
    --ref-split: 58%;
}
@media (prefers-color-scheme: dark) {
    :root {
        --ref-text: #e6e9ef;
        --ref-muted: #a5adbb;
        --ref-border: #2b3240;
        --ref-accent: #8fa8ff;
        --ref-soft: #1e2636;
        --ref-bg: #0f131a;
        --ref-nav-bg: #121722;
        --ref-code-bg: #161b26;
        --ref-panel: #0a0e14;
        --ref-panel-2: #121821;
        --ref-panel-border: #232b38;
        --ref-get: #4cc283;
        --ref-post: #8fa8ff;
        --ref-patch: #e2a74d;
        --ref-ok: #4cc283;
        --ref-err: #f07272;
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
}
body.ref {
    margin: 0;
    background: var(--ref-bg);
    color: var(--ref-text);
    font: 15px/1.6 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow-x: hidden;
}
.ref a {
    color: var(--ref-accent);
}
.ref code {
    font-family: Consolas, Menlo, "Liberation Mono", monospace;
    font-size: 13px;
}
.ref p {
    margin: 0 0 12px;
}

/* --- layout -------------------------------------------------------------- */
.ref-layout {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    min-height: 100vh;
}
.ref-topbar {
    display: none;
}
.ref-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ref-nav-bg);
    border-right: 1px solid var(--ref-border);
    min-width: 0;
}
.ref-main {
    min-width: 0;
    /* One continuous dark band on the right, behind every row. */
    background: linear-gradient(90deg, var(--ref-bg) 0, var(--ref-bg) var(--ref-split), var(--ref-panel) var(--ref-split), var(--ref-panel) 100%);
}
.ref-row {
    display: grid;
    grid-template-columns: var(--ref-split) minmax(0, 1fr);
    border-bottom: 1px solid var(--ref-border);
}
.ref-row:last-of-type {
    border-bottom: 0;
}
.ref-doc {
    padding: 36px 40px;
    min-width: 0;
}
.ref-aside {
    padding: 36px 28px;
    color: var(--ref-panel-text);
    min-width: 0;
}
.ref-tag-row .ref-doc {
    padding-top: 48px;
    padding-bottom: 8px;
}
.ref-tag-row {
    border-bottom: 0;
}

/* --- navigation ---------------------------------------------------------- */
.ref-nav-head {
    padding: 18px 16px 12px;
    border-bottom: 1px solid var(--ref-border);
}
.ref-brand {
    display: inline-block;
    font-weight: 700;
    font-size: 17px;
    color: var(--ref-text);
    text-decoration: none;
    margin-bottom: 12px;
}
.ref .ref-brand {
    color: var(--ref-text);
}
.ref-brand span {
    color: var(--ref-accent);
}
.ref-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--ref-border);
    border-radius: 8px;
    background: var(--ref-bg);
    color: var(--ref-text);
    font: inherit;
    font-size: 13px;
}
.ref-search:focus {
    outline: 2px solid var(--ref-soft);
    border-color: var(--ref-accent);
}
.ref-nav-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 16px;
}
.ref-nav-heading {
    margin: 14px 8px 4px;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ref-muted);
}
.ref-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ref-nav-list a,
.ref-nav-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    color: var(--ref-text);
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.35;
}
.ref .ref-nav-list a,
.ref .ref-nav-tag {
    color: var(--ref-text);
}
.ref-nav-tag {
    font-weight: 600;
    margin-top: 6px;
}
.ref-nav-group .ref-nav-list a {
    padding-left: 12px;
}
.ref-nav-list a:hover,
.ref-nav-tag:hover {
    background: var(--ref-soft);
}
.ref .ref-nav-list a.active,
.ref .ref-nav-tag.active {
    background: var(--ref-soft);
    color: var(--ref-accent);
}
.ref-nav-text {
    min-width: 0;
    overflow-wrap: anywhere;
}
.ref-nav-empty {
    margin: 12px 8px;
    color: var(--ref-muted);
    font-size: 13px;
}
.ref-nav-foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-top: 1px solid var(--ref-border);
    font-size: 13px;
}

/* --- badges and status codes -------------------------------------------- */
.ref-badge {
    flex: none;
    display: inline-block;
    min-width: 44px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .03em;
    text-align: center;
    color: #fff;
    background: var(--ref-muted);
}
.ref-badge-get { background: var(--ref-get); }
.ref-badge-post { background: var(--ref-post); }
.ref-badge-patch { background: var(--ref-patch); }
.ref-badge-delete { background: var(--ref-delete); }
@media (prefers-color-scheme: dark) {
    .ref-badge { color: #0f131a; }
}
.ref-status {
    display: inline-block;
    min-width: 40px;
    font-weight: 700;
    font-family: Consolas, Menlo, monospace;
    font-size: 13px;
}
.ref-status-ok { color: var(--ref-ok); }
.ref-status-error { color: var(--ref-err); }

/* --- documentation column ----------------------------------------------- */
.ref-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.ref h1 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.25;
}
.ref h2 {
    margin: 0 0 12px;
    font-size: 22px;
    line-height: 1.3;
}
.ref h3 {
    margin: 22px 0 8px;
    font-size: 16px;
}
.ref-tag-title {
    font-size: 26px;
}
.ref-op-title {
    margin-top: 0;
    font-size: 19px;
}
.ref-sub {
    margin: 26px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ref-border);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ref-muted);
}
.ref-langs a {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 4px;
    border-radius: 999px;
    border: 1px solid var(--ref-border);
    font-size: 12px;
    text-decoration: none;
}
.ref .ref-langs a {
    color: var(--ref-muted);
}
.ref .ref-langs a.active {
    background: var(--ref-soft);
    color: var(--ref-accent);
    border-color: transparent;
}
.ref-version {
    color: var(--ref-muted);
    font-size: 13px;
}
.ref-lead {
    font-size: 16px;
}
.ref-note {
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--ref-soft);
    font-size: 14px;
}
.ref-muted {
    color: var(--ref-muted);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}
.ref-doc code {
    background: var(--ref-code-bg);
    padding: 1px 5px;
    border-radius: 4px;
    overflow-wrap: anywhere;
}
.ref-endpoint {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 16px;
    padding: 8px 12px;
    border: 1px solid var(--ref-border);
    border-radius: 8px;
    background: var(--ref-code-bg);
}
.ref-endpoint code {
    background: none;
    padding: 0;
    font-size: 14px;
}
.ref-desc p:last-child {
    margin-bottom: 0;
}
.ref-meta {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px 14px;
    margin: 14px 0 0;
    font-size: 14px;
}
.ref-meta dt,
.ref-dl dt {
    color: var(--ref-muted);
}
.ref-meta dd,
.ref-dl dd {
    margin: 0;
    min-width: 0;
}
.ref-dl {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 14px;
    font-size: 14px;
}

/* tables */
.ref-table-wrap {
    overflow-x: auto;
}
.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.ref-table th,
.ref-table td {
    text-align: left;
    vertical-align: top;
    padding: 7px 8px;
    border-bottom: 1px solid var(--ref-border);
}
.ref-table th {
    color: var(--ref-muted);
    font-weight: 600;
}
.ref-table td code {
    white-space: nowrap;
}
.ref-scope-op {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    text-decoration: none;
    font-size: 13px;
}

/* schema trees */
.ref-fields.is-nested {
    margin-top: 6px;
    padding-left: 12px;
    border-left: 2px solid var(--ref-border);
}
.ref-field {
    display: grid;
    grid-template-columns: minmax(120px, 32%) minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--ref-border);
}
.ref-field:last-child {
    border-bottom: 0;
}
.ref-field-name {
    min-width: 0;
    overflow-wrap: anywhere;
}
.ref-field-name code {
    font-weight: 600;
}
.ref-required {
    display: block;
    font-size: 11px;
    color: var(--ref-err);
}
.ref-field-info {
    min-width: 0;
    font-size: 14px;
}
.ref-field-type {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 2px;
}
.ref-type {
    color: var(--ref-muted);
    font-family: Consolas, Menlo, monospace;
    font-size: 13px;
}
.ref-chip {
    padding: 0 6px;
    border-radius: 4px;
    background: var(--ref-soft);
    color: var(--ref-muted);
    font-size: 12px;
}
.ref-kv {
    margin-top: 3px;
    font-size: 13px;
}
.ref-k {
    color: var(--ref-muted);
}
.ref-children {
    margin-top: 6px;
}
.ref-children > summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--ref-accent);
}

/* responses */
.ref-response {
    border: 1px solid var(--ref-border);
    border-radius: 8px;
    margin-bottom: 6px;
}
.ref-response > summary {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 8px 12px;
    cursor: pointer;
    list-style: none;
}
.ref-response > summary::-webkit-details-marker {
    display: none;
}
.ref-response > summary::before {
    content: "\25B8";
    color: var(--ref-muted);
    font-size: 12px;
}
.ref-response[open] > summary::before {
    content: "\25BE";
}
.ref-response-desc {
    min-width: 0;
    font-size: 14px;
}
.ref-response-desc p {
    margin: 0;
}
.ref-response-body {
    padding: 0 12px 10px;
}
.ref-response-body:empty {
    display: none;
}

/* --- sample panel -------------------------------------------------------- */
.ref-panel + .ref-panel {
    margin-top: 22px;
}
.ref-panel-title {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ref-panel-muted);
}
.ref-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.ref-tab {
    padding: 4px 10px;
    border: 1px solid var(--ref-panel-border);
    border-radius: 6px;
    background: transparent;
    color: var(--ref-panel-muted);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}
.ref-tab:hover {
    color: var(--ref-panel-text);
}
.ref-tab.active {
    background: var(--ref-panel-2);
    color: var(--ref-panel-text);
    border-color: var(--ref-panel-muted);
}
.ref-tab.is-success {
    color: #6fd39a;
}
.ref-tab.is-error {
    color: #ff9b9b;
}
.ref-code-wrap {
    position: relative;
}
.ref-code {
    margin: 0;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--ref-panel-2);
    color: var(--ref-panel-text);
    overflow-x: auto;
    font-size: 12.5px;
    line-height: 1.55;
    max-height: 560px;
}
.ref-code code {
    font-size: inherit;
    white-space: pre;
}
.ref-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border: 1px solid var(--ref-panel-border);
    border-radius: 6px;
    background: var(--ref-panel);
    color: var(--ref-panel-muted);
    font: inherit;
    font-size: 11.5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
}
.ref-code-wrap:hover .ref-copy,
.ref-copy:focus-visible {
    opacity: 1;
}
.ref-copy:hover {
    color: var(--ref-panel-text);
}

.ref-footer .ref-doc {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--ref-muted);
    font-size: 13px;
    padding-top: 20px;
    padding-bottom: 40px;
}

/* --- narrower screens ---------------------------------------------------- */
@media (max-width: 1180px) {
    .ref-main {
        background: var(--ref-bg);
    }
    .ref-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .ref-aside {
        padding: 0 40px 36px;
    }
    .ref-aside:empty {
        display: none;
    }
    .ref-panel {
        padding: 16px;
        border-radius: 10px;
        background: var(--ref-panel);
    }
    .ref-copy {
        opacity: 1;
    }
}
@media (max-width: 860px) {
    /* The sticky top bar (~54px) must not cover a heading reached from the
       menu or an #anchor link. */
    html {
        scroll-padding-top: 64px;
    }
    .ref h3.ref-op-title {
        margin-top: 0;
    }
    .ref-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .ref-topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        background: var(--ref-nav-bg);
        border-bottom: 1px solid var(--ref-border);
    }
    .ref-topbar .ref-brand {
        margin: 0;
    }
    .ref-menu-btn {
        padding: 5px 12px;
        border: 1px solid var(--ref-border);
        border-radius: 8px;
        background: var(--ref-bg);
        color: var(--ref-text);
        font: inherit;
        font-size: 13px;
        cursor: pointer;
    }
    .ref-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 40;
        width: min(320px, 86vw);
        height: 100%;
        transform: translateX(-102%);
        /* Closed = out of the tab order and the accessibility tree, but only
           after the slide-out has finished. */
        visibility: hidden;
        transition: transform .2s ease, visibility 0s linear .2s;
        box-shadow: 0 0 24px rgba(0, 0, 0, .25);
    }
    body.ref-nav-open .ref-nav {
        transform: none;
        visibility: visible;
        transition: transform .2s ease, visibility 0s;
    }
    .ref-doc {
        padding: 24px 16px;
    }
    .ref-aside {
        padding: 0 16px 24px;
    }
    .ref-head {
        flex-direction: column;
    }
    .ref-langs a:first-child {
        margin-left: 0;
    }
    .ref-field {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }
    .ref h1 {
        font-size: 24px;
    }
}
