/* Agentic Core — документация API. Дизайн-токены Carbon (белая тема g10). */
:root {
  --background: #ffffff;
  --layer-01: #f4f4f4;
  --layer-02: #ffffff;
  --field-01: #f4f4f4;
  --border-subtle: #e0e0e0;
  --border-strong: #8d8d8d;
  --text-primary: #161616;
  --text-secondary: #525252;
  --text-helper: #6f6f6f;
  --text-on-color: #ffffff;
  --link: #0f62fe;
  --link-hover: #0043ce;
  --focus: #0f62fe;
  --error: #da1e28;
  --shell-bg: #161616;
  --shell-text: #f4f4f4;
  --code-bg: #161616;
  --code-text: #f4f4f4;
  --code-border: #393939;
  --get: #24a148; --get-bg: #defbe6; --get-tx: #0e6027;
  --post: #0f62fe; --post-bg: #d0e2ff; --post-tx: #0043ce;
  --patch: #8a3ffc; --patch-bg: #e8daff; --patch-tx: #6929c4;
  --delete: #da1e28; --delete-bg: #ffd7d9; --delete-tx: #a2191f;
  --sidebar-w: 270px;
  --shell-h: 48px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--background);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
code, pre, .mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

/* ===== Shell (Carbon UI Shell header) ===== */
.shell {
  position: sticky; top: 0; z-index: 40;
  height: var(--shell-h);
  background: var(--shell-bg);
  color: var(--shell-text);
  display: flex; align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #393939;
}
.shell-brand { display: flex; align-items: center; gap: 8px; color: var(--shell-text); }
.shell-brand:hover { text-decoration: none; }
.shell-brand img { display: block; filter: brightness(0) invert(1); }
.shell-name { font-style: italic; font-weight: 600; letter-spacing: .01em; }
.shell-reg { font-style: normal; font-size: .6em; vertical-align: super; opacity: .7; }
.shell-sep { color: #6f6f6f; }
.shell-section { color: #c6c6c6; font-weight: 400; }
.shell-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.shell-ver {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  color: #a8a8a8; border: 1px solid #393939; padding: 2px 8px;
}
.shell-link { color: #c6c6c6; font-size: 13px; }
.shell-link:hover { color: #fff; text-decoration: none; }
.shell-burger { display: none; background: none; border: 0; color: var(--shell-text); cursor: pointer; padding: 6px; margin-left: auto; }

/* ===== Layout ===== */
.wrap { display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: var(--shell-h);
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: calc(100vh - var(--shell-h));
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
  background: var(--background);
  padding-bottom: 40px;
}
.scrim { display: none; }
.content {
  flex: 1 1 auto; min-width: 0;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 48px 120px;
}

/* ===== Search (Carbon Search) ===== */
.search {
  position: sticky; top: 0; z-index: 2;
  background: var(--background);
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.search-box { position: relative; height: 40px; }
.search-mag {
  position: absolute; left: 12px; top: 0; bottom: 0; margin: auto 0;
  height: 16px; color: var(--text-secondary); pointer-events: none;
}
.search input {
  width: 100%; height: 40px; border: 0; background: var(--field-01);
  border-bottom: 1px solid var(--border-strong);
  padding: 0 40px 0 40px; font-size: 14px; font-family: inherit; color: var(--text-primary);
}
.search input::placeholder { color: #a8a8a8; }
.search input:focus { outline: 2px solid var(--focus); outline-offset: -2px; }
.search-clear {
  position: absolute; right: 0; top: 0; height: 40px; width: 40px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--text-secondary); cursor: pointer;
}
.search-clear:hover { background: #e0e0e0; }
.search-clear[hidden] { display: none; }

/* ===== Nav ===== */
.nav { padding: 10px 0; }
.nav-group { margin-bottom: 2px; }
.nav-group-title {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-helper);
  padding: 14px 16px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px 7px 16px;
  color: var(--text-secondary); font-size: 13px;
  border-left: 2px solid transparent; cursor: pointer;
}
.nav-item:hover { background: var(--layer-01); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: #e8e8e8; color: var(--text-primary); border-left-color: var(--link); font-weight: 500; }
.nav-item .m { font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 600; letter-spacing: .03em; flex: 0 0 auto; width: 38px; display: flex; align-items: center; }
.m.get { color: var(--get-tx); } .m.post { color: var(--post-tx); }
.m.patch { color: var(--patch-tx); } .m.delete { color: var(--delete-tx); }
.nav-item .m .ic { width: 16px; height: 16px; color: var(--text-helper); }
.nav-item:hover .m .ic, .nav-item.active .m .ic { color: var(--text-primary); }
.nav-item.hidden { display: none; }
.nav-group.hidden { display: none; }

/* ===== Sections ===== */
.section { scroll-margin-top: calc(var(--shell-h) + 16px); padding: 26px 0 30px; border-bottom: 1px solid var(--border-subtle); }
.section:last-child { border-bottom: 0; }
.section h2 { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
.section h3 { font-size: 18px; font-weight: 600; margin: 28px 0 10px; }
.section h4 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; }
.section p { margin: 10px 0; color: var(--text-secondary); }
.section p strong, .section li strong { color: var(--text-primary); font-weight: 600; }
.section ul, .section ol { margin: 10px 0; padding-left: 22px; color: var(--text-secondary); }
.section li { margin: 5px 0; }
.lead { font-size: 16px; color: var(--text-secondary); max-width: 70ch; }

/* inline code */
.section :not(pre) > code {
  font-size: 12.5px; background: var(--layer-01);
  border: 1px solid var(--border-subtle); padding: 1px 5px; color: #c2185b;
  border-radius: 0;
}

/* endpoint header */
.ep-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.method {
  font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 12px;
  letter-spacing: .03em; padding: 3px 9px; color: #fff; border-radius: 2px;
}
.method.get { background: var(--get); } .method.post { background: var(--post); }
.method.patch { background: var(--patch); } .method.delete { background: var(--delete); }
.ep-path { font-family: 'IBM Plex Mono', monospace; font-size: 15px; color: var(--text-primary); word-break: break-all; }
.ep-path .pv { color: #8a3ffc; }

/* two-column endpoint body (Stripe/Postman docs) */
.cols { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr); gap: 36px; align-items: start; }
.cols .right { position: sticky; top: calc(var(--shell-h) + 20px); }
@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; gap: 18px; } .cols .right { position: static; } }

/* meta chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chip {
  font-size: 11.5px; padding: 3px 9px; border: 1px solid var(--border-subtle);
  background: var(--layer-01); color: var(--text-secondary);
}
.chip b { color: var(--text-primary); font-weight: 600; }
.chip.auth { background: var(--post-bg); border-color: #a6c8ff; color: var(--post-tx); }
.chip.scope { background: var(--patch-bg); border-color: #d4bbff; color: var(--patch-tx); }
.chip.noauth { background: var(--get-bg); border-color: #a7f0ba; color: var(--get-tx); }

/* tables */
table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
thead th { background: var(--layer-01); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-secondary); }
td code { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--text-primary); }
td .req { color: var(--error); font-size: 11px; font-weight: 600; }

/* code card (dark) */
.code {
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid var(--code-border); margin: 12px 0;
}
.code-head { display: flex; align-items: center; border-bottom: 1px solid var(--code-border); }
.code-tabs { display: flex; }
.code-tab {
  background: none; border: 0; color: #a8a8a8; cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; padding: 9px 14px;
  border-bottom: 2px solid transparent;
}
.code-tab:hover { color: #f4f4f4; }
.code-tab.active { color: #f4f4f4; border-bottom-color: var(--link); }
.code-label { color: #6f6f6f; font-size: 11px; padding: 9px 12px; font-family: 'IBM Plex Mono', monospace; }
.code-copy {
  margin-left: auto; background: none; border: 0; color: #a8a8a8; cursor: pointer;
  font-size: 11px; padding: 9px 12px; font-family: 'IBM Plex Sans', sans-serif;
  display: flex; align-items: center; gap: 6px;
}
.code-copy:hover { color: #f4f4f4; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; }
.code pre code { white-space: pre; }
.code-pane { display: none; }
.code-pane.active { display: block; }
.resp-status { font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 9px 12px; color: #a8a8a8; }
.resp-status .ok { color: #42be65; }
.resp-status .err { color: #fa4d56; }

/* tokens in code */
.code .s { color: #a7f0ba; } /* string */
.code .k { color: #78a9ff; } /* key */
.code .n { color: #d4bbff; } /* number/bool */
.code .c { color: #6f6f6f; } /* comment */
.code .cm { color: #ff8389; } /* http method/curl flag */

/* callout */
.note {
  border-left: 3px solid var(--link); background: var(--layer-01);
  padding: 12px 16px; margin: 16px 0; color: var(--text-secondary);
}
.note.warn { border-left-color: #f1c21b; }
.note.purple { border-left-color: #8a3ffc; }
.note b { color: var(--text-primary); }

/* status code list */
.codes { margin: 10px 0; }
.codes .row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px; }
.codes .row:last-child { border-bottom: 0; }
.codes .sc { font-family: 'IBM Plex Mono', monospace; font-weight: 600; flex: 0 0 84px; }
.codes .sc.s2 { color: var(--get-tx); } .codes .sc.s4 { color: var(--delete-tx); } .codes .sc.s5 { color: #a2191f; }

/* footer */
.foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border-subtle); color: var(--text-helper); font-size: 12px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* responsive sidebar */
@media (max-width: 860px) {
  .shell-actions { display: none; }
  .shell-burger { display: block; }
  .content { padding: 28px 20px 100px; }
  .sidebar {
    position: fixed; top: var(--shell-h); left: 0; z-index: 35;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 0 0 0 100vmax transparent;
  }
  .sidebar.open { transform: translateX(0); }
  .scrim.open { display: block; position: fixed; inset: var(--shell-h) 0 0 0; background: rgba(0,0,0,.4); z-index: 34; }
  .cols { grid-template-columns: 1fr; }
}
