:root {
    /* ─── Brand ───────────────────────────────────────────── */
    --primary:        #f97316;
    --primary-rgb:    249, 115, 22;
    --primary-dark:   #ea580c;
    --accent:         #f59e0b;
    --accent-rgb:     245, 158, 11;

    /* ─── Backgrounds ─────────────────────────────────────── */
    --bg:             #0d1117;
    --bg-rgb:         13, 17, 23;
    --bg-deep:        #090c10;
    --bg-elevated:    #111827;
    --surface:        #161b22;
    --surface-hover:  #1c2128;

    /* ─── Text ────────────────────────────────────────────── */
    --text:           #e6edf3;
    --text-muted:     #7d8590;
    --text-subtle:    #484f58;
    --text-bright:    #e2e8f0;

    /* ─── Borders ─────────────────────────────────────────── */
    --border:         #21262d;
    --border-soft:    #30363d;

    /* ─── Status colours ──────────────────────────────────── */
    --green:          #22c55e;
    --green-dim:      rgba(34, 197, 94, 0.1);
    --blue:           #58a6ff;
    --blue-dim:       rgba(88, 166, 255, 0.1);
    --amber:          #f59e0b;
    --amber-dim:      rgba(245, 158, 11, 0.12);
    --red:            #ef4444;
    --red-dim:        rgba(239, 68, 68, 0.1);
    --purple:         #bc8cff;
    --purple-dim:     rgba(188, 140, 255, 0.1);

    /* ─── Layout ──────────────────────────────────────────── */
    --sidebar-w:      256px;
    --header-h:       48px;
    --font:           Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono:           "JetBrains Mono", "Fira Code", Consolas, monospace;
    --r:              8px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a5568; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ────────────────────────────────────────────── */
#docs-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 200;
    gap: 12px;
}

.h-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none !important;
}

.h-mark {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.h-brand {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: -0.2px;
}

.h-sep {
    width: 1px;
    height: 18px;
    background: var(--border-soft);
}

.h-badge {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(var(--primary-rgb), 0.35);
    white-space: nowrap;
}

.h-spacer { flex: 1; }

.h-link {
    font-size: 12px;
    color: var(--text-subtle);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}
.h-link:hover { color: var(--text-muted); text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────── */
#layout {
    display: flex;
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
    max-width: 100vw;
    overflow-x: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-deep);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
}

.sb-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.sb-section:last-child { border-bottom: none; }

.sb-cap {
    padding: 0 16px 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-family: var(--mono);
}

.sb-tag {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-family: var(--mono);
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px;
    font-size: 12px;
    color: #9aabb8;
    cursor: pointer;
    transition: color 0.12s, background 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
}
.sb-link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}
.sb-link.active {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
}

.sb-method {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    width: 36px;
    text-align: right;
}

.sb-path {
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--mono);
    font-size: 11px;
    color: #6d7f90;
    flex: 1;
}
.sb-link:hover .sb-path,
.sb-link.active .sb-path { color: inherit; }

/* sidebar method colours */
.sm-get    { color: var(--green); }
.sm-post   { color: var(--blue); }
.sm-put    { color: var(--amber); }
.sm-patch  { color: var(--purple); }
.sm-delete { color: var(--red); }

/* ── Main content ──────────────────────────────────────── */
#content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    padding: 44px 52px 80px;
    max-width: 840px;
}

/* ── Overview ──────────────────────────────────────────── */
#overview {
    scroll-margin-top: calc(var(--header-h) + 20px);
}

.ov-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    color: var(--text-bright);
}

.ov-desc {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-muted);
    margin-bottom: 20px;
    max-width: 600px;
}

.ov-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-muted);
}
.chip-lbl {
    color: var(--text-subtle);
    font-size: 11px;
    font-family: var(--mono);
}

.rule {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

/* ── Tag heading ───────────────────────────────────────── */
.tag-h {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 16px;
    scroll-margin-top: calc(var(--header-h) + 20px);
    color: var(--text-bright);
}

/* ── Endpoint card ─────────────────────────────────────── */
.ep {
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    margin-bottom: 10px;
    background: var(--surface);
    scroll-margin-top: calc(var(--header-h) + 20px);
    transition: border-color 0.15s;
}
.ep:hover { border-color: var(--border-soft); }

.ep-hd {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s;
}
.ep-hd:hover { background: rgba(255, 255, 255, 0.02); }
.ep.open .ep-hd { border-bottom: 1px solid var(--border); }

.meth {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.m-get    { color: var(--green);  background: var(--green-dim); }
.m-post   { color: var(--blue);   background: var(--blue-dim); }
.m-put    { color: var(--amber);  background: var(--amber-dim); }
.m-patch  { color: var(--purple); background: var(--purple-dim); }
.m-delete { color: var(--red);    background: var(--red-dim); }

.ep-path {
    font-family: var(--mono);
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ep-sum {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chevron {
    color: var(--text-subtle);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.ep.open .chevron { transform: rotate(90deg); }

.ep-body {
    padding: 20px 18px;
    display: none;
}
.ep.open .ep-body { display: block; }

.ep-desc {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-muted);
    margin-bottom: 18px;
}

/* ── Auth tag ───────────────────────────────────────────── */
.auth-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: var(--amber-dim);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--amber);
    margin-bottom: 18px;
}

/* ── Section label ──────────────────────────────────────── */
.slbl {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 8px;
    opacity: 0.85;
}

/* ── Parameters ─────────────────────────────────────────── */
.ptbl {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 22px;
}
.ptbl th {
    text-align: left;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-subtle);
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}
.ptbl td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 13px;
}
.ptbl tr:last-child td { border-bottom: none; }

.p-name {
    font-family: var(--mono);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.req-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--red);
    flex-shrink: 0;
}

.in-badge {
    font-family: var(--mono);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.type-badge {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--purple);
}

.p-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}
.p-ex {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-subtle);
    margin-top: 3px;
}

/* ── Responses ──────────────────────────────────────────── */
.resp-list { margin-bottom: 22px; }

.resp-item {
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 6px;
    overflow: hidden;
}

.resp-hd {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}
.resp-hd:hover { background: rgba(255, 255, 255, 0.02); }

.stat {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    min-width: 36px;
    text-align: center;
}
.s2 { color: var(--green); background: var(--green-dim); }
.s3 { color: var(--amber); background: var(--amber-dim); }
.s4 { color: var(--red);   background: var(--red-dim); }
.s5 { color: var(--red);   background: var(--red-dim); }

.resp-desc {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
}

.resp-item .chevron { color: var(--text-subtle); transition: transform 0.2s; }
.resp-item.open .chevron { transform: rotate(90deg); }

.resp-body {
    padding: 12px 13px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
    display: none;
}
.resp-item.open .resp-body { display: block; }

/* ── Schema ─────────────────────────────────────────────── */
.schema-wrap {
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    margin-top: 6px;
    font-size: 12px;
}

.schema-hdr {
    display: grid;
    grid-template-columns: 150px 120px 1fr;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}
.schema-hdr span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-subtle);
}

.schema-row {
    display: grid;
    grid-template-columns: 150px 120px 1fr;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    align-items: baseline;
}
.schema-row:last-child { border-bottom: none; }
.schema-row:nth-child(odd) { background: rgba(255, 255, 255, 0.01); }

.s-field {
    font-family: var(--mono);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    word-break: break-all;
}
.s-type { font-family: var(--mono); font-size: 11px; color: var(--purple); }
.s-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.s-ex   { font-family: var(--mono); font-size: 11px; color: var(--text-subtle); margin-top: 2px; }

.arr-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* ── Code block ─────────────────────────────────────────── */
.code-wrap {
    position: relative;
    margin-top: 6px;
    border-radius: var(--r);
    overflow: hidden;
    border: 1px solid var(--border);
}

.code-blk {
    background: var(--bg-deep);
    padding: 12px 48px 12px 16px;
    font-family: var(--mono);
    font-size: 12px;
    color: #c9d1d9;
    line-height: 1.65;
    overflow-x: auto;
    white-space: pre;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 10px;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.copy-btn.ok    { color: var(--green); border-color: rgba(34, 197, 94, 0.35); }

/* ── States ─────────────────────────────────────────────── */
#state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 180px;
    color: var(--text-muted);
    margin-left: var(--sidebar-w);
}

.spin {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-soft);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile nav toggle ──────────────────────────────────── */
.h-menu {
    display: none;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 12px;
    font-family: var(--font);
}
.h-menu:hover  { background: rgba(255,255,255,0.08); color: var(--text); }
.h-menu:active { transform: translateY(0.5px); }
.h-menu-txt    { display: inline; }

.sb-overlay {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 250;
}

.tbl-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: rgba(255,255,255,0.01);
}
.tbl-wrap .ptbl { margin: 0; border-collapse: collapse; min-width: 680px; }
.tbl-wrap::-webkit-scrollbar { height: 6px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 980px) {
    #content { padding: 32px 22px 70px; max-width: 1000px; }
    .ep-sum  { max-width: 200px; }
}

@media (max-width: 860px) {
    .h-menu { display: inline-flex; }
    .h-link { display: none; }

    #sidebar {
        width: min(84vw, 320px);
        transform: translateX(-110%);
        transition: transform 0.22s ease;
        z-index: 300;
        box-shadow: 14px 0 40px rgba(0,0,0,0.4);
    }
    body.sb-open #sidebar    { transform: translateX(0); }
    body.sb-open #sb-overlay { display: block; }

    #content { margin-left: 0; padding: 26px 16px 64px; max-width: 100%; overflow-x: hidden; min-width: 0; }
    #state   { margin-left: 0; }

    .ep       { overflow: hidden; max-width: 100%; }
    .ep-body  { overflow-x: auto; min-width: 0; }
    .ep-hd   { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
    .ep-path { flex: 1 1 100%; white-space: normal; word-break: break-all; overflow: hidden; min-width: 0; }
    .ep-sum  { flex: 1 1 100%; max-width: none; white-space: normal; }
    .chevron { margin-left: auto; }

    .chip     { overflow-wrap: anywhere; }
    .code-wrap { max-width: 100%; }
    .code-blk  { overflow-x: auto; max-width: 100%; }
    .schema-wrap { max-width: 100%; overflow-x: auto; }
    .resp-body  { overflow-x: auto; min-width: 0; }
}

@media (max-width: 680px) {
    .schema-hdr { display: none; }
    .schema-row { grid-template-columns: 1fr; gap: 6px; }
    .schema-wrap { font-size: 12px; }
    .code-blk { padding-right: 14px; }
    .copy-btn { position: static; margin-top: 8px; display: inline-flex; }
}
