/* Документация (/docs): вид как у docs.datool.ru, цвета сайта agent-mark (site.css).
   Раскладка: своя полоса сверху (.dx-bar: логотип, ссылки, кнопка кабинета), под ней
   колонки на всю ширину — меню слева (.dx-side) и содержимое (.dx-main). Статья —
   текст и «На странице» справа; справочник методов API — строки «описание | тёмная
   колонка примеров» (.dx-row), тёмные ячейки сливаются в одну колонку.
   Шаблоны — templates/docs/, скрипт — static/docs.js. */

.docs-app { --dx-bar: 60px; --dx-code-col: #1f2328; --dx-code-box: #15181c; --dx-code-ink: #e6e8eb;
  --dx-code-muted: #9aa0a6; --dx-link: var(--accent-text); background: var(--card); }
/* У сайта section — блок главной с большим отступом; в документации section — пункт меню или строка */
.docs-app section { margin-top: 0; }

/* ---------- Полоса сверху ---------- */
.dx-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px;
  height: var(--dx-bar); padding: 0 22px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); }
.dx-bar__logo { display: flex; align-items: center; gap: 10px; flex: none; }
.dx-bar__logo .dx-bar__badge { padding: 2px 8px; border-radius: 6px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.dx-bar__nav { display: flex; gap: 18px; flex: 1; }
.dx-bar__nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.dx-bar__nav a:hover { color: var(--ink); }
.dx-bar__menu { display: none; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; }
/* Кнопка кабинета и флажок языка — справа; на телефоне меню ссылок скрыто, поэтому прижимаем сами */
.dx-bar__actions { display: flex; align-items: center; gap: 12px; flex: none; margin-left: auto; }
.dx-bar__menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- Колонки ---------- */
.dx { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: calc(100vh - var(--dx-bar)); }
.dx-main { min-width: 0; }

/* ---------- Меню слева ---------- */
.dx-side { position: sticky; top: var(--dx-bar); align-self: start; height: calc(100vh - var(--dx-bar));
  overflow-y: auto; padding: 18px 14px 40px; background: var(--bg); border-right: 1px solid var(--line); }
.dx-seg { display: flex; gap: 3px; padding: 3px; margin-bottom: 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); }
.dx-seg a { flex: 1; text-align: center; padding: 6px 8px; border-radius: 7px; color: var(--muted);
  font-size: 13.5px; font-weight: 700; text-decoration: none; }
.dx-seg a:hover { color: var(--ink); }
.dx-seg a.is-active { background: var(--accent); color: #fff; }
.dx-nav { display: grid; gap: 12px; }
.dx-block { display: grid; gap: 1px; }
.dx-block__head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0;
  border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700;
  line-height: 1.35; text-align: left; text-decoration: none; cursor: pointer; }
.dx-block__head:hover { color: var(--accent-text); }
.dx-block__head:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dx-block__link { font-weight: 400; }
.dx-fold-arrow { width: 16px; height: 16px; flex: none; margin-left: auto; margin-right: 6px; fill: none;
  stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.dx-block.is-folded .dx-fold-arrow { transform: rotate(-90deg); }
.dx-block.is-folded .dx-items { display: none; }
.docs-icon { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.dx-items, .dx-subs { list-style: none; margin: 0; padding: 0; }
.dx-item { display: block; padding: 5px 8px 5px 35px; border-radius: 8px; color: var(--ink); font-size: 15px;
  line-height: 1.35; text-decoration: none; }
.dx-item:hover { color: var(--accent-text); }
.dx-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.dx-subs { margin: 3px 0 8px 35px; border-left: 1px solid var(--line); }
.dx-subs a { display: flex; align-items: baseline; gap: 6px; margin-left: -1px; padding: 4px 10px;
  border-left: 2px solid transparent; color: var(--muted); font-size: 14px; line-height: 1.35; text-decoration: none; }
.dx-subs a:hover { color: var(--ink); }
.dx-subs a.is-current { border-left-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.dx-subs .docs-verb { margin: 0; padding: 0 4px; font-size: 9.5px; }

/* ---------- Хлебные крошки ---------- */
.dx-crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.docs-prose .dx-crumbs a, .dx-crumbs a { color: var(--muted); text-decoration: none; }
.dx-crumbs a:hover { color: var(--accent-text); }
.dx-crumbs [aria-current] { color: var(--ink); }

/* ---------- Статья: текст и «На странице» ---------- */
.dx-main--article { display: grid; grid-template-columns: minmax(0, 1fr) 290px; align-items: start; }
.dx-article { padding: 34px 48px 50px; min-width: 0; }
.dx-aside { position: sticky; top: var(--dx-bar); display: grid; gap: 18px; align-content: start;
  padding: 34px 22px; min-height: calc(100vh - var(--dx-bar)); border-left: 1px solid var(--line); }
.dx-aside__meta { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dx-aside__meta a { color: var(--dx-link); white-space: nowrap; } /* адрес почты не рвётся на дефисе */
.docs-toc { display: grid; gap: 8px; line-height: 1.35; }
.docs-toc b { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.docs-toc a { font-size: 15px; color: var(--dx-link); text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 3px; }
.docs-toc a:hover { color: var(--ink); }
.dx-pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 26px; padding-top: 16px;
  border-top: 1px solid var(--line); }
.docs-prose .dx-pager a { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); font-weight: 700; text-decoration: none; }
.docs-prose .dx-pager a:hover { border-color: var(--accent); color: var(--accent-text); }
.dx-pager small { color: var(--muted); font-size: 12px; font-weight: 400; }
.dx-pager__next { text-align: right; margin-left: auto; }

/* ---------- Главные пространств ---------- */
.dx-main--wide { padding: 34px 48px 50px; }
.dx-landing { display: grid; gap: 22px; max-width: 1120px; }
.docs-hero h1 { margin: 0 0 6px; font-size: 30px; font-weight: 800; line-height: 1.2; text-wrap: balance; }
.docs-hero p { margin: 0; color: var(--muted); max-width: 68ch; }
.docs-popular { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 16px; border-radius: 12px;
  background: var(--accent-soft); font-size: 14px; }
.docs-popular b { width: 100%; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-text); }
.docs-popular a { color: var(--accent-text); }
.docs-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 26px; }
.docs-col h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.docs-col h2::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.docs-col ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.docs-col li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px;
  border-bottom: 1px solid var(--line); font-size: 14px; }
.docs-col li a { color: var(--ink); text-decoration: none; }
.docs-col li a:hover { color: var(--accent-text); }
.docs-col li > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.docs-col li code { font-size: 12px; }
.docs-col__button { display: inline-flex; min-height: 36px; margin-top: 12px; align-items: center; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 14px; text-decoration: none; }
.docs-col__button:hover { border-color: var(--accent); color: var(--accent-text); }
.docs-projsection { display: grid; gap: 8px; margin-top: 12px; padding-top: 22px; border-top: 1px solid var(--line); }
.docs-projhead { display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: 22px; font-weight: 800; }
.docs-projhead a { color: var(--ink); text-decoration: none; }
.docs-projhead a:hover { color: var(--accent-text); }
.docs-projhead span { color: var(--muted); font-size: 14px; font-weight: 400; }
.docs-projtext { margin: 0; color: var(--muted); max-width: 72ch; }
.docs-projtext a { color: var(--dx-link); }

/* ---------- Справочник методов: «описание | тёмная колонка примеров» ---------- */
.dx-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); scroll-margin-top: var(--dx-bar); }
.dx-cell { padding: 32px 44px 34px; border-bottom: 1px solid var(--line); min-width: 0; }
.dx-row--head .dx-cell { padding-top: 34px; }
.dx-row--foot .dx-cell { border-bottom: 0; }
.dx-cell h1, .dx-cell h2 { margin-top: 0; }
.dx-code { background: var(--dx-code-col); color: var(--dx-code-ink); padding: 32px 26px 34px; min-width: 0; }
.dx-code__sticky { position: sticky; top: calc(var(--dx-bar) + 18px); display: grid; gap: 8px; }
.dx-code h4 { margin: 8px 0 0; color: #fff; font-size: 15px; }
.dx-code h4:first-child { margin-top: 0; }
.dx-code p { margin: 0 0 4px; color: var(--dx-code-muted); font-size: 13px; }
.dx-row--foot .dx-code, .dx-row--head .dx-code { min-height: 100%; }
.docs-sig { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 12px; padding: 9px 12px;
  border-radius: 10px; background: var(--bg); }
.docs-sig code { padding: 0; background: none; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.docs-sig--get { background: #ebfaf2; }
.docs-sig--post { background: #edf2f8; }
.docs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.docs-chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); }
.docs-chip--brand { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); }
.docs-required { font-size: 11px; color: #916818; }
.docs-type { font-size: 12px; color: var(--muted); }
.docs-codebox { border-radius: 10px; background: var(--dx-code-box); overflow: hidden; }
.docs-codebox__tabs { display: flex; gap: 18px; padding: 10px 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.docs-codebox__tabs button { padding: 0 0 8px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--dx-code-muted); font: inherit; font-size: 13px; cursor: pointer; }
.docs-codebox__tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--accent); }
.docs-codebox pre { position: relative; margin: 0; padding: 14px 16px; background: none; color: var(--dx-code-ink);
  overflow-x: auto; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 70vh; }
.docs-codebox pre[hidden] { display: none; }

/* ---------- Плашки методов HTTP ---------- */
.docs-verb { display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 6px; background: #ebfaf2;
  color: #198754; font: 700 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; vertical-align: 1px; }
.docs-verb--post { background: #edf2f8; color: #185091; }
.docs-sig .docs-verb { margin: 0; padding: 4px 10px; color: #fff; font-size: 12px; }
.docs-sig .docs-verb--get { background: #198754; }
.docs-sig .docs-verb--post { background: #185091; }

/* ---------- Текст статьи ---------- */
.docs-prose { color: var(--ink); font-size: 16px; line-height: 1.6; }
.docs-prose h1 { margin: 0 0 12px; font-size: 30px; font-weight: 800; line-height: 1.2; text-wrap: balance; }
.docs-prose h2 { margin: 30px 0 8px; font-size: 21px; font-weight: 700; line-height: 1.25;
  scroll-margin-top: calc(var(--dx-bar) + 16px); }
.docs-prose h3 { margin: 22px 0 8px; font-size: 16px; font-weight: 700; }
.docs-prose p, .docs-prose li { max-width: 72ch; overflow-wrap: anywhere; }
.docs-prose a { color: var(--dx-link); text-decoration: underline; text-underline-offset: 2px; }
.docs-prose a:hover { color: var(--ink); }
.docs-prose ol, .docs-prose ul { display: grid; gap: 4px; margin: 8px 0 14px; padding-left: 22px; }
.docs-prose li::marker { color: var(--muted); }
.docs-prose table { width: 100%; margin: 10px 0; border-collapse: collapse; font-size: 14px; }
.docs-table-wrap { overflow-x: auto; }
.docs-prose th { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 400;
  font-size: 12.5px; text-align: left; }
.docs-prose td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.docs-prose code { padding: 1px 5px; border-radius: 5px; background: var(--bg); font-size: .9em; overflow-wrap: anywhere; }
.docs-prose pre { position: relative; margin: 12px 0; padding: 14px 16px; border-radius: 10px;
  background: var(--dx-code-col); color: var(--dx-code-ink); overflow-x: auto; font-size: 13px; line-height: 1.55; }
.docs-prose pre code { padding: 0; background: none; color: inherit; font-size: inherit; overflow-wrap: normal; }
.docs-copy { position: absolute; top: 8px; right: 8px; padding: 3px 9px; border: 1px solid #3a4049; border-radius: 6px;
  background: #262b32; color: #c3c7cb; font: inherit; font-size: 12px; cursor: pointer; }
.docs-copy:hover { color: #fff; }
.docs-prose .admonition { margin: 14px 0; padding: 10px 14px; border-radius: 10px; max-width: 72ch; }
.docs-prose .admonition p { margin: 4px 0; }
.docs-prose .admonition-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.docs-prose .admonition.note { background: #edf2f8; color: #185091; }
.docs-prose .admonition.warning { background: #faf5eb; color: #916818; }
.docs-prose .admonition.danger { background: var(--accent-soft); color: var(--accent-text); }
.docs-prose .admonition a { color: inherit; }
/* Пример разметки прямо в статье: так пометки выглядят у читателя */
/* Скриншоты кабинета и пометок (шаблон docs/_shot.html): по ширине колонки, щелчок — полный размер */
.docs-prose .docs-shot { margin: 16px 0 24px; }
.docs-prose .docs-shot a { display: block; }
.docs-prose .docs-shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: 12px; background: #f3f3f1; }
.docs-prose .docs-shot figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.docs-prose .docs-shot a { cursor: zoom-in; }
/* Всплывающее окно со снимком (docs.js) */
.docs-lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; overflow: hidden; }
.docs-lightbox::backdrop { background: rgba(17, 17, 16, .94); }
.docs-lightbox__body { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 64px 72px 24px; }
.docs-lightbox__body img { display: block; max-width: min(1400px, 100%); max-height: calc(100vh - 150px);
  width: auto; height: auto; border-radius: 12px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.docs-lightbox__caption { margin: 0; max-width: 900px; color: #fff; font-size: 15px; line-height: 1.45; text-align: center; }
.docs-lightbox button { position: fixed; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font: 28px/1 system-ui, sans-serif;
  cursor: pointer; }
.docs-lightbox button:hover, .docs-lightbox button:focus-visible { background: rgba(255, 255, 255, .28); }
.docs-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.docs-lightbox__close { top: 14px; right: 14px; }
.docs-lightbox__nav { top: 50%; transform: translateY(-50%); }
.docs-lightbox__prev { left: 14px; }
.docs-lightbox__next { right: 14px; }
.docs-lightbox.is-single .docs-lightbox__nav { display: none; }
.docs-lightbox-open { overflow: hidden; }
@media (max-width: 700px) {
  .docs-lightbox__body { padding: 64px 12px 72px; }
  .docs-lightbox__nav { top: auto; bottom: 14px; transform: none; }
  .docs-lightbox__prev { left: calc(50% - 56px); }
  .docs-lightbox__next { right: calc(50% - 56px); }
}
.docs-prose .docs-example { margin: 12px 0; padding: 14px 18px; border-radius: 10px; background: var(--bg); }
.docs-prose .docs-example p { margin: 6px 0; }
.docs-prose .docs-example .am-mark { color: var(--accent); font-weight: 700; }
.docs-prose .docs-example .am-inline { color: #c4382b; }
.docs-prose .docs-example .am-footnotes { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted); }
.docs-prose .docs-example .am-warning { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; line-height: 1.4; }

/* ---------- Узкий экран и телефон ---------- */
@media (max-width: 1180px) {
  .dx-main--article { grid-template-columns: minmax(0, 1fr); }
  .dx-aside { position: static; min-height: 0; border-left: 0; border-top: 1px solid var(--line); padding: 22px 48px 40px; }
}
@media (max-width: 980px) {
  .dx { grid-template-columns: minmax(0, 1fr); }
  .dx-bar { gap: 10px; padding: 0 12px; }
  .dx-bar__menu { display: grid; }
  .dx-bar__nav { display: none; }
  .dx-side { position: fixed; z-index: 25; top: var(--dx-bar); left: 0; width: min(320px, 86vw);
    height: calc(100vh - var(--dx-bar)); transform: translateX(-102%); transition: transform .2s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
  .dx.is-menu-open .dx-side { transform: none; }
  .dx-article, .dx-main--wide { padding: 22px var(--gutter) 36px; }
  .dx-aside { padding: 18px var(--gutter) 30px; }
  .dx-row { grid-template-columns: minmax(0, 1fr); }
  .dx-cell { padding: 24px var(--gutter); border-bottom: 0; }
  .dx-code { padding: 18px var(--gutter) 24px; }
  .dx-row--head .dx-code, .dx-row--foot .dx-code { display: none; }
  .dx-code__sticky { position: static; }
}
/* Узкий телефон: логотип, кнопка и флажок помещаются в одну строку */
@media (max-width: 420px) {
  .dx-bar { gap: 8px; }
  .dx-bar__logo { font-size: 19px; gap: 0; }
  .dx-bar__logo .dx-bar__badge { display: none; }
  .dx-bar__actions { gap: 8px; }
  .dx-bar__actions .btn.small { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { .dx-side, .dx-fold-arrow { transition: none; } }
