:root {
  --bg: #ffffff;
  --panel: #f7f8fa;
  --text: #15191e;
  --muted: #5f6b7a;
  --line: #e4e7eb;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --code: #f3f4f6;
  --bad: #cf222e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --panel: #11161d;
    --text: #e6edf3;
    --muted: #8b949e;
    --line: #2a313a;
    --accent: #4c8dff;
    --accent-soft: #15233b;
    --code: #161b22;
    --bad: #f85149;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }
:not(pre) > code { background: var(--code); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow: auto; line-height: 1.5; }
table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: 14.5px; margin: 12px 0; }
th, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
.brand .muted { font-weight: 400; }
.menu { display: none; background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 4px 9px; }
.search { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.search input { width: 100%; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.search input:focus { outline: 2px solid var(--accent); }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgb(0 0 0 / .15); overflow: hidden; }
.result { display: grid; gap: 2px; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); }
.result:first-child { border-top: 0; }
.result.active, .result:hover { background: var(--accent-soft); text-decoration: none; }
.r-title { font-weight: 600; }
.r-desc { color: var(--muted); font-size: 13.5px; }
.ask-row { color: var(--accent); }
.ask { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; white-space: nowrap; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 32px; max-width: 1360px; margin: 0 auto; padding: 0 20px; }
.side { position: sticky; top: 61px; height: calc(100vh - 61px); overflow: auto; padding: 22px 0; }
.nav-group { margin-bottom: 18px; }
.nav-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 6px 10px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--text); font-size: 14.5px; }
.side a:hover { background: var(--panel); text-decoration: none; }
.side a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.doc { padding: 26px 0 80px; min-width: 0; }
.doc h1 { font-size: 32px; line-height: 1.2; margin: 0 0 16px; }
.doc h2 { font-size: 23px; margin: 36px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 18px; margin: 26px 0 8px; }
.anchor { float: left; margin-left: -20px; width: 20px; opacity: 0; color: var(--muted); }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor { opacity: 1; text-decoration: none; }
.toc { position: sticky; top: 61px; height: calc(100vh - 61px); overflow: auto; padding: 30px 0; font-size: 13.5px; }
.toc-title { font-weight: 700; margin-bottom: 6px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 3px 0; color: var(--muted); }
.toc a:hover { color: var(--text); }

.op { border: 1px solid var(--line); border-radius: 10px; padding: 4px 16px 10px; margin: 14px 0; }
.op h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 16px; }
.op h4 { margin: 14px 0 4px; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.method { font: 700 12px/1 ui-monospace, monospace; padding: 4px 7px; border-radius: 5px; color: #fff; }
.m-get { background: #1a7f37; } .m-post { background: #1f6feb; } .m-put, .m-patch { background: #9a6700; } .m-delete { background: #cf222e; }
.req { font-size: 11px; color: var(--bad); }
.responses { font-size: 14px; }

.ask-panel { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .45); display: grid; place-items: center; padding: 16px; }
.ask-box { width: min(760px, 100%); height: min(80vh, 760px); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.ask-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ask-head h2 { margin: 0; font-size: 17px; }
.icon { background: none; border: 0; color: var(--muted); font-size: 18px; }
.ask-thread { flex: 1; overflow: auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
.msg { border-radius: 10px; padding: 10px 14px; max-width: 100%; overflow-wrap: anywhere; }
.msg.user { background: var(--accent-soft); justify-self: end; max-width: 85%; white-space: pre-wrap; }
.msg.bot { background: var(--panel); border: 1px solid var(--line); }
.msg.bot > :first-child { margin-top: 0; } .msg.bot > :last-child { margin-bottom: 0; }
.msg pre { font-size: 12.5px; }
.typing { color: var(--muted); }
.error { color: var(--bad); }
.ask-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.ask-form textarea { flex: 1; resize: none; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 16px; font-weight: 600; }
body.ask-open { overflow: hidden; }

@media (max-width: 1100px) { .layout { grid-template-columns: 230px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 760px) {
  .top { gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
  .menu { display: block; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .ask { margin-left: auto; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .side { display: none; position: static; height: auto; }
  body.nav-open .side { display: block; }
  .doc h1 { font-size: 26px; }
}
