.docs {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px;
    padding: 12px 0 80px;
}

/* ---- Navigation ---- */
.toc {
    position: sticky;
    top: 0;
    align-self: start;
    font-size: 0.9rem;
}

.toc .brand {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    margin-bottom: 4px;
}

.toc .version {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.toc-group {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 18px 0 6px;
}

.toc a {
    display: block;
    color: var(--text-main);
    text-decoration: none;
    padding: 4px 10px;
    margin-left: -10px;
    border-radius: 6px;
    opacity: 0.8;
}

.toc a:hover {
    background: var(--bg-hover);
    opacity: 1;
}

.toc .back {
    margin-top: 24px;
    color: var(--accent-purple);
    opacity: 1;
}

/* ---- Content ---- */
.content {
    min-width: 0;
    line-height: 1.65;
}

h1 {
    font-size: 2rem;
    margin: 0 0 8px;
}

.lead {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin: 0 0 28px;
}

h2 {
    font-size: 1.35rem;
    margin: 48px 0 12px;
    padding-top: 8px;
    scroll-margin-top: 16px;
}

h3 {
    font-size: 1.05rem;
    margin: 28px 0 8px;
}

p {
    margin: 0 0 14px;
}

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

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 5px;
}

.pre-wrap {
    position: relative;
    margin: 0 0 16px;
}

pre {
    margin: 0;
    padding: 14px 16px;
    background: var(--bg-card-dark);
    border: 1px solid var(--border-input);
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.55;
}

pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-input);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.pre-wrap:hover .copy,
.copy:focus-visible {
    opacity: 1;
}

.callout {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    margin: 0 0 16px;
    font-size: 0.92rem;
    background: var(--btn-modal-action);
    border: 1px solid var(--btn-modal-action-border);
}

.callout i {
    color: var(--accent-purple);
    margin-top: 4px;
}

.callout.warn {
    background: var(--notif-warn-bg);
    border-color: var(--notif-warn-border);
}

.callout.warn i {
    color: var(--notif-warn-text);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 18px;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-input);
    vertical-align: top;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-wrap {
    overflow-x: auto;
}

/* ---- Endpoint cards ---- */
.endpoint {
    border: 1px solid var(--border-setting);
    border-radius: 12px;
    padding: 18px 20px 4px;
    margin: 0 0 18px;
    background: linear-gradient(180deg, var(--bg-card), var(--bg-card-dark));
    scroll-margin-top: 16px;
}

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

.method {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.03em;
    border: 1px solid currentColor;
}

.GET { color: #22c55e; }
.POST { color: #3b82f6; }
.PUT { color: #f59e0b; }
.PATCH { color: #a855f7; }
.DELETE { color: #ef4444; }

.path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    word-break: break-all;
}

.needs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

.tag {
    font-size: 0.72rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--bg-input);
    color: var(--text-muted);
    white-space: nowrap;
}

.tag.scope {
    background: var(--btn-modal-action);
    color: var(--text-main);
}

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

    .toc {
        position: static;
    }

    .toc-links,
    .toc-guides .toc-group,
    .docs.embedded .toc .version {
        display: none;
    }

    /* Only the pages stay reachable on a phone: a row of links instead of the sidebar. */
    .toc-guides {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 8px;
    }

    .toc .toc-guides a {
        margin-left: 0;
    }

    .needs {
        margin-left: 0;
    }

    .copy {
        opacity: 1;
    }
}

/* ---- Guide navigation ---- */
.toc a.current {
    background: var(--bg-hover);
    opacity: 1;
    font-weight: 600;
}

/* ---- Embedded in the dashboard's Docs tab ---- */
.docs.embedded {
    padding-top: 0;
}

.docs.embedded .toc .brand,
.docs.embedded .toc .back {
    display: none;
}
