:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #142033;
    --muted: #5c6b80;
    --line: #e4e8ee;
    --accent: #1d4ed8;
    --accent-soft: #e8efff;
    --top: #0f172a;
    --code: #0f172a;
    --code-text: #e7edf6;
    --warn: #9a6700;
    --warn-bg: #fff7e6;
    --ok: #067647;
    --danger: #b42318;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #121a2b;
    --text: #e7edf6;
    --muted: #9aa8bd;
    --line: #243044;
    --accent: #93c5fd;
    --accent-soft: #1e293b;
    --top: #020617;
    --code: #020617;
    --code-text: #e7edf6;
    --warn: #f5d28a;
    --warn-bg: #3a2d12;
    --ok: #86efac;
    --danger: #fca5a5;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 16px;
    align-items: center;
    height: 64px;
    padding: 0 20px;
    background: var(--top);
    color: white;
}
.brand { display: flex; align-items: center; gap: 10px; color: white; font-weight: 700; }
.brand img { height: 28px; }
.top-links { display: flex; gap: 14px; align-items: center; }
.top-links a { color: #dbe4f0; font-size: 14px; }
.search {
    margin-left: auto;
    width: min(360px, 40vw);
    background: #1e293b;
    border: 1px solid #334155;
    color: white;
    border-radius: 8px;
    padding: 8px 10px;
}
.icon-button, .menu-button {
    background: transparent;
    color: white;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}
.menu-button { display: none; }
.env-banner {
    background: var(--warn-bg);
    color: var(--warn);
    padding: 8px 20px;
    font-size: 14px;
}
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 104px); }
.sidebar {
    border-right: 1px solid var(--line);
    background: var(--surface);
    padding: 18px 12px 40px;
}
.sidebar a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}
.sidebar a.active, .sidebar a:hover { background: var(--accent-soft); text-decoration: none; }
.sidebar h2 { margin: 18px 10px 6px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.content { padding: 32px 40px 80px; max-width: 1180px; }
.narrow { max-width: 820px; }
h1 { font-size: 36px; line-height: 1.15; margin: 0 0 12px; }
h2 { margin-top: 32px; }
h3 { margin-top: 24px; }
.muted { color: var(--muted); }
.card, .callout, table { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card, .callout { padding: 16px 18px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.steps { counter-reset: step; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.step input { margin-top: 4px; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; background: var(--accent-soft); }
.badge.beta { background: #fff7e6; color: #9a6700; }
.badge.planned { background: var(--line); color: var(--muted); }
.badge.verified { background: #e8f8ef; color: var(--ok); }
html[data-theme="dark"] .badge.beta { background: #3a2d12; color: #f5d28a; }
table { width: 100%; border-collapse: collapse; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
pre {
    position: relative;
    background: var(--code);
    color: var(--code-text);
    padding: 16px;
    border-radius: 12px;
    overflow: auto;
    font-size: 13px;
}
.copy {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 0;
    border-radius: 6px;
    background: #334155;
    color: white;
    padding: 4px 8px;
    cursor: pointer;
}
.method { font-weight: 800; font-size: 12px; color: var(--ok); }
.playground {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: start;
}
.playground label { display: block; font-size: 13px; font-weight: 700; margin: 10px 0 4px; }
textarea, select.field {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--bg);
    border-radius: 8px;
    padding: 8px;
}
textarea { min-height: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.primary, .secondary {
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    margin-right: 8px;
}
.primary { background: var(--accent); color: white; }
.secondary { background: var(--line); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tabs button[aria-selected="true"] { background: var(--accent); color: white; }
.response-meta { display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.search-results {
    position: absolute;
    right: 20px;
    top: 58px;
    width: min(420px, calc(100vw - 40px));
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-height: 360px;
    overflow: auto;
}
.search-results a { display: block; padding: 10px 12px; color: var(--text); }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.hidden { display: none; }

@media (max-width: 1050px) {
    .playground { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .menu-button { display: inline-block; }
    .top-links { display: none; }
    .shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .sidebar.open { display: block; }
    .content { padding: 24px 16px 64px; }
    h1 { font-size: 30px; }
}
