/* /api-docs (backend/app/web/apidocs.py): sticky menu left, reference right.
   Site rules: solid colours only (no gradients), borders, no hover lift; accent blue, action buttons green. */
.seo-page:has(> .ref-wrap) { max-width: 1320px; }
.ref-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 44px; align-items: start; padding-top: 72px; }
.ref-main { min-width: 0; }

/* ---- sidebar */
.ref-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin;
  padding: 14px 10px 14px 0; border-right: 2px solid var(--g-edge); font-size: 14px; }
.ref-group { margin: 0 0 14px; }
.ref-side .ref-h { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text); font-weight: 800;
  text-decoration: none; letter-spacing: -.01em; }
.ref-side ul { list-style: none; margin: 2px 0 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); margin-left: 10px; }
.ref-side li a { display: block; padding: 3px 10px; color: var(--muted); text-decoration: none; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-side a:hover { color: var(--text); background: var(--panel-2); }
.ref-side a.on { color: var(--accent-ink); background: var(--accent-soft); font-weight: 700; }

/* ---- content */
.seo-page .ref-main section.ref-sec { margin: 0 0 52px; scroll-margin-top: 16px; }
.ref-main [id] { scroll-margin-top: 16px; }
.ref-main h1 { font-size: clamp(32px, 4.2vw, 50px); line-height: 1.05; font-weight: 800; margin: 14px 0 12px; }
.ref-main .lead { margin: 0 0 20px; max-width: 760px; text-align: left; }
.ref-main h2 { padding-bottom: 8px; border-bottom: 2px solid var(--g-edge); }
.ref-main h3 { font-size: 19px; font-weight: 800; margin: 26px 0 10px; }
.ref-main h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 6px; }
.ref-main p, .ref-main li { line-height: 1.65; max-width: 860px; }
.ref-main code { font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .88em;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; overflow-wrap: anywhere; }
.ref-list, .ref-steps { padding-left: 22px; }
.ref-list li, .ref-steps li { margin: 0 0 8px; }
.ref-steps li::marker { font-weight: 800; color: var(--accent-ink); }
.ref-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.ref-cta .btn { min-height: 44px; padding: 0 20px; font-weight: 800; border: 2px solid var(--g-edge); box-shadow: var(--g-hard-sm); }
.ref-cta .btn:hover { transform: none; }
.ref-cta .btn.ref-go, .ref-cta .btn.ref-go:hover { background: var(--g-green); color: var(--g-ink); }

/* code blocks */
.ref-code { margin: 0 0 14px; border: 2px solid var(--g-edge); border-radius: 12px; overflow: hidden; background: var(--bg-soft); max-width: 100%; }
.ref-code-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 6px 5px 12px;
  background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.ref-copy { font: inherit; font-size: 12px; text-transform: none; letter-spacing: 0; cursor: pointer; padding: 3px 12px;
  border-radius: 7px; border: 1px solid var(--g-edge); background: var(--g-green); color: var(--g-ink); font-weight: 800; }
.ref-copy:hover { background: #35bd6e; }
.ref-copy.done { background: var(--panel); color: var(--text); }
.ref-code pre { margin: 0; padding: 12px 14px; overflow-x: auto; scrollbar-width: thin; }
.ref-main .ref-code pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.55; white-space: pre; overflow-wrap: normal; }

/* tables */
.ref-main .tg-table-wrap { margin-bottom: 14px; }
.ref-table td, .ref-table th { vertical-align: top; line-height: 1.5; }
.ref-table td:first-child { white-space: nowrap; }
.ref-params td:nth-child(4), .ref-params td:nth-child(5) { min-width: 220px; }
.ref-kv th[scope="row"] { width: 170px; text-transform: none; font-size: 13px; color: var(--muted); font-weight: 700;
  background: var(--panel-2); white-space: nowrap; }
.ref-kv td code { margin: 0 4px 3px 0; display: inline-block; }
.ref-opts td:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* model categories */
.ref-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.ref-chip { padding: 5px 12px; border-radius: 999px; border: 2px solid var(--g-edge); color: var(--text); text-decoration: none;
  font-size: 13px; font-weight: 700; background: var(--panel); }
.ref-chip:hover { border-color: var(--accent-border); color: var(--accent-ink); }
.ref-model { margin: 0 0 28px; padding: 20px 22px; border: 2px solid var(--g-edge); border-top: 6px solid var(--k, var(--g-accent));
  border-radius: 18px; background: var(--panel); }
.ref-model header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ref-model header h3 { margin: 0; }
.ref-model .ref-id { font-size: 14px; }
.ref-badge { font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--k, var(--g-accent)); color: var(--g-ink); }
.ref-model > p.muted { margin: 8px 0 14px; }
.ref-returns { font-size: 14px; color: var(--muted); margin: 6px 0 0; }

/* ---- phones / tablets: the menu becomes one horizontal chip row at the top */
@media (max-width: 980px) {
  .ref-wrap { display: block; padding-top: 64px; }
  .ref-side { position: sticky; top: var(--ref-top, 0px); z-index: 5; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden;
    max-height: none; margin: 0 -16px 18px; padding: 10px 16px; border-right: 0; border-bottom: 2px solid var(--g-edge);
    background: var(--bg); scrollbar-width: none; }
  .ref-side::-webkit-scrollbar { display: none; }
  .ref-group { margin: 0; flex: none; }
  .ref-side ul { display: none; }
  .ref-side .ref-h { white-space: nowrap; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--g-edge);
    font-size: 13px; background: var(--panel); }
  .seo-page .ref-main section.ref-sec { scroll-margin-top: 124px; }
  .ref-main [id] { scroll-margin-top: 124px; }
}
@media (max-width: 640px) {
  .ref-model { padding: 16px 14px; }
  .ref-kv th[scope="row"] { width: auto; white-space: normal; }
  .ref-table td:first-child { white-space: normal; }
  .ref-params td:nth-child(4), .ref-params td:nth-child(5) { min-width: 180px; }
}
.ref-table td code, .ref-kv td code { overflow-wrap: normal; white-space: nowrap; }
