/* Developer docs (/developers). Builds on main.css tokens. */
.docs { --code-bg: #0D1016; --code-border: rgba(255,255,255,0.07); --body: #C3C9D2; }
.docs-layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 56px; align-items: start; }

/* ---- Sidebar ---- */
.docs-side { position: sticky; top: calc(var(--nav-h, 72px) + 24px); max-height: calc(100vh - var(--nav-h, 72px) - 48px); overflow-y: auto; padding: 4px 4px 24px 0; scrollbar-width: thin; }
.docs-side-label { font-family: var(--font-display); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: #6B7380; margin: 0 0 8px; }
.docs-nav, .docs-toc { display: flex; flex-direction: column; gap: 1px; margin-bottom: 26px; }
.docs-nav a, .docs-toc a { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.92rem; padding: 6px 12px; border-left: 2px solid rgba(255,255,255,0.06); transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease; }
.docs-nav a:hover, .docs-toc a:hover { color: var(--text-primary); text-decoration: none; border-left-color: rgba(255,255,255,0.25); }
.docs-nav a[aria-current="page"] { color: var(--accent-primary); border-left-color: var(--accent-primary); background: linear-gradient(90deg, rgba(255,138,61,0.10), transparent); font-weight: 600; }
.docs-toc a { font-size: 0.84rem; padding: 4px 12px; }
.docs-toc a.active { color: var(--text-primary); border-left-color: var(--accent-secondary); }
.docs-nav .ext { width: 12px; height: 12px; opacity: 0.6; flex: none; }

/* ---- Article ---- */
.docs-body { min-width: 0; max-width: 880px; }
.docs-crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: #6B7380; margin: 0 0 14px; }
.docs-crumbs a { color: var(--text-muted); }
.docs-body h1 { font-size: clamp(2rem, 4.2vw, 2.75rem); line-height: 1.12; letter-spacing: -0.02em; margin-bottom: 18px; }
.docs-body h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin: 60px 0 16px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,0.06); scroll-margin-top: calc(var(--nav-h, 72px) + 16px); }
.docs-body h3 { font-size: 1.12rem; margin: 32px 0 10px; scroll-margin-top: calc(var(--nav-h, 72px) + 16px); }
.docs-body h2 .anchor, .docs-body h3 .anchor { margin-left: 10px; color: #4B5361; font-weight: 500; opacity: 0; transition: opacity 120ms ease; text-decoration: none; }
.docs-body h2:hover .anchor, .docs-body h3:hover .anchor, .docs-body .anchor:focus-visible { opacity: 1; }
.docs-body .anchor:hover { color: var(--accent-primary); }
.docs-body p, .docs-body li { color: var(--body); line-height: 1.75; }
.docs-body p { margin: 0 0 14px; }
.docs-body ul, .docs-body ol { padding-left: 22px; margin: 0 0 18px; }
.docs-body li { margin: 5px 0; }
.docs-body li::marker { color: #5B6472; }
.docs-body strong { color: var(--text-primary); }
.docs-body em { color: #DDE2E8; }
.docs-body a:not(.btn):not(.dev-card):not(.anchor) { text-decoration: underline; text-decoration-color: rgba(255,138,61,0.35); text-underline-offset: 3px; }
.docs-body a:not(.btn):not(.dev-card):not(.anchor):hover { text-decoration-color: var(--accent-primary); }
.docs-body code { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; font-size: 0.85em; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.07); border-radius: 6px; padding: 1px 6px; color: #F5D0B5; overflow-wrap: anywhere; }
.docs-body a code { color: inherit; }

/* ---- Code blocks ---- */
.docs-body pre { position: relative; background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 12px; padding: 18px 20px; margin: 0 0 20px; overflow-x: auto; box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset; }
.docs-body pre[data-lang] { padding-top: 36px; }
.docs-body pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 10px; left: 20px; font: 600 0.68rem var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: #5B6472; }
.docs-body pre code { background: none; border: 0; padding: 0; color: #DDE3EA; font-size: 0.84rem; line-height: 1.7; overflow-wrap: normal; white-space: pre; }
.tok-c { color: #6B7686; font-style: italic; }
.tok-s { color: #A5D6A7; }
.tok-k { color: #C792EA; }
.tok-n { color: #F78C6C; }
.tok-f { color: #82AAFF; }
.tok-p { color: #FFCB6B; }
.tok-flag { color: #89DDFF; }
.docs-copy { position: absolute; top: 8px; right: 8px; font: 600 0.72rem var(--font-body); color: var(--text-muted); background: #161A22; border: 1px solid var(--code-border); border-radius: 6px; padding: 4px 10px; cursor: pointer; opacity: 0; transition: opacity 150ms ease, color 150ms ease; }
.docs-body pre:hover .docs-copy, .docs-copy:focus-visible, .docs-copy.done { opacity: 1; }
.docs-copy:hover { color: var(--text-primary); }
.docs-copy.done { color: var(--success); }

/* ---- Callouts ---- */
.callout { border: 1px solid rgba(124,140,255,0.25); background: linear-gradient(135deg, rgba(124,140,255,0.08), rgba(124,140,255,0.02)); border-radius: 12px; padding: 12px 16px; margin: 0 0 20px; }
.callout p { margin: 0; font-size: 0.92rem; }
.callout p + p { margin-top: 8px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; }
.docs-body table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.docs-body th { text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 0.82rem; color: var(--text-primary); background: var(--surface); padding: 10px 14px; white-space: nowrap; }
.docs-body td { padding: 10px 14px; border-top: 1px solid rgba(255,255,255,0.06); color: var(--body); vertical-align: top; }
.docs-body tbody tr:hover td { background: rgba(255,255,255,0.02); }
.docs-body table.endpoints td:first-child { white-space: nowrap; width: 1%; }
.docs-body table.endpoints td:nth-child(2) code { color: #E6EAF0; }
.docs-body td code { white-space: nowrap; }
.m { display: inline-block; min-width: 52px; text-align: center; font: 700 0.68rem ui-monospace, Menlo, monospace; letter-spacing: 0.04em; border-radius: 6px; padding: 3px 6px; margin: 1px 0; border: 1px solid; }
.m-get { color: #4ADE80; background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.3); }
.m-post { color: #FF9F5A; background: rgba(255,138,61,0.08); border-color: rgba(255,138,61,0.3); }
.m-put, .m-patch { color: #7C9CFF; background: rgba(124,140,255,0.09); border-color: rgba(124,140,255,0.32); }
.m-delete { color: #FF7070; background: rgba(255,92,92,0.08); border-color: rgba(255,92,92,0.3); }
.hw-badge { display: inline-block; font: 700 0.62rem var(--font-display); letter-spacing: 0.06em; color: var(--accent-primary); background: rgba(255,138,61,0.12); border: 1px solid rgba(255,138,61,0.4); border-radius: 999px; padding: 1px 7px; vertical-align: middle; margin-left: 6px; }

/* ---- API filter ---- */
.api-filter { position: sticky; top: calc(var(--nav-h, 72px) + 8px); z-index: 5; display: flex; align-items: center; gap: 12px; margin: 28px 0 8px; padding: 8px; background: rgba(11,13,18,0.85); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; }
.api-filter input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; color: var(--text-primary); font: 500 0.92rem var(--font-body); padding: 9px 12px 9px 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B93A0' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 12px center; }
.api-filter input:focus { outline: none; border-color: rgba(255,138,61,0.6); }
.api-filter span { color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; padding-right: 6px; }
.filter-hidden { display: none !important; }

/* ---- Tabs ---- */
.docs-tabs { margin: 0 0 22px; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; background: rgba(18,21,28,0.6); overflow: hidden; }
.docs-tablist { display: none; gap: 2px; padding: 6px; border-bottom: 1px solid rgba(255,255,255,0.06); overflow-x: auto; }
.docs-tabs.ready .docs-tablist { display: flex; }
.docs-tablist button { font: 600 0.86rem var(--font-body); color: var(--text-muted); background: none; border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.docs-tablist button:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.docs-tablist button[aria-selected="true"] { color: var(--text-primary); background: rgba(255,138,61,0.14); box-shadow: inset 0 0 0 1px rgba(255,138,61,0.35); }
.docs-tab-panel { padding: 16px 16px 2px; }
.docs-tabs.ready .docs-tab-panel[hidden] { display: none; }
.docs-tabs.ready .tab-fallback { display: none; }
.docs-tab-panel .tab-fallback { margin-top: 0; }
.docs-tab-panel pre { margin-bottom: 14px; }

/* ---- Overview ---- */
.docs-hero { position: relative; padding: 8px 0 8px; margin-bottom: 8px; }
.docs-hero::before { content: ""; position: absolute; inset: -60px 0 auto -40px; height: 260px; background: radial-gradient(ellipse at 20% 30%, rgba(255,138,61,0.16), transparent 60%), radial-gradient(ellipse at 80% 10%, rgba(124,140,255,0.14), transparent 55%); filter: blur(10px); z-index: -1; pointer-events: none; }
.docs-eyebrow { font: 600 0.78rem var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-primary) !important; margin-bottom: 10px !important; }
.docs-lead { font-size: 1.12rem; color: #D2D7DE !important; max-width: 680px; }
.docs-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 8px; }
.dev-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 30px 0 8px; }
.dev-card { position: relative; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(160deg, #151922, #10131A); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 22px; color: var(--text-primary); transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease; }
.dev-card:hover { border-color: var(--card-border-hover); transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.35); text-decoration: none; }
.dev-card strong { font-family: var(--font-display); font-size: 1.08rem; }
.dev-card span { color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; }
.dev-card .dev-card-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,138,61,0.12); border: 1px solid rgba(255,138,61,0.3); color: var(--accent-primary); font: 700 0.85rem ui-monospace, Menlo, monospace; margin-bottom: 4px; }
.dev-card em { margin-top: auto; padding-top: 6px; font-style: normal; font-weight: 600; font-size: 0.88rem; color: var(--accent-primary); }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 18px; }
.feature-grid > div { background: var(--surface); border: 1px solid rgba(255,255,255,0.07); border-radius: 12px; padding: 16px 18px; }
.feature-grid strong { display: block; font-family: var(--font-display); margin-bottom: 6px; }
.feature-grid span { color: var(--text-muted); font-size: 0.88rem; line-height: 1.6; }
.link-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
.link-grid a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.07); background: rgba(18,21,28,0.7); text-decoration: none !important; transition: border-color 150ms ease, background-color 150ms ease; }
.link-grid a:hover { border-color: rgba(255,138,61,0.45); background: rgba(255,138,61,0.05); }
.link-grid strong { font-size: 0.95rem; color: var(--text-primary); }
.link-grid span { font-size: 0.82rem; color: var(--text-muted); }

/* ---- Pager / help ---- */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 64px 0 18px; }
.docs-pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; text-decoration: none !important; transition: border-color 150ms ease, transform 150ms ease; }
.docs-pager a:hover { border-color: rgba(255,138,61,0.5); transform: translateY(-2px); }
.docs-pager span { font-size: 0.8rem; color: var(--text-muted); }
.docs-pager strong { font-family: var(--font-display); color: var(--text-primary); }
.docs-pager .pager-next { text-align: right; grid-column: 2; }
.docs-help { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 14px 18px; border-radius: 12px; background: var(--surface); border: 1px solid rgba(255,255,255,0.06); font-size: 0.9rem; color: var(--text-muted); }

@media (max-width: 1000px) {
    .dev-cards, .feature-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .docs-side { position: static; max-height: none; min-width: 0; padding: 0; }
    .docs-toc, .docs-toc-label { display: none; }
    .docs-side-label { display: none; }
    .docs-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
    .docs-nav a { border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; padding: 5px 14px; font-size: 0.86rem; }
    .docs-nav a[aria-current="page"] { border-color: rgba(255,138,61,0.5); background: rgba(255,138,61,0.08); }
    .docs-nav[aria-label="Resources"] { display: none; }
    .link-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
    /* Endpoint tables become stacked rows: method + path, then details. */
    .table-wrap:has(table.endpoints) { overflow: visible; }
    table.endpoints thead { display: none; }
    table.endpoints tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.06); }
    table.endpoints tbody tr:first-child { border-top: 0; }
    table.endpoints td { padding: 0; border: 0; }
    .docs-body table.endpoints td:first-child { width: auto; }
    table.endpoints td:nth-child(2) code { white-space: normal; overflow-wrap: anywhere; }
    table.endpoints td:nth-child(n+3) { grid-column: 1 / -1; font-size: 0.84rem; }
    table.endpoints td:nth-child(n+3):empty { display: none; }
    table.endpoints td:nth-child(3):not(:empty)::before { content: "Body / query: "; color: #6B7380; }
    table.endpoints td code { white-space: normal; }
}
@media (max-width: 600px) {
    .dev-cards, .feature-grid, .link-grid, .docs-pager { grid-template-columns: 1fr; }
    .docs-pager .pager-next { grid-column: 1; }
    .api-filter { position: static; }
}
