/* ===== База знаний (pages/docs.php, assets/js/docs.js) ===== */
.kb-body { background: #fff; --kb-top-h: 64px; }
html { scroll-padding-top: 84px; }

/* шапка */
.kb-top { position: sticky; top: 0; z-index: 30; height: var(--kb-top-h); background: rgba(255, 255, 255, .94); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--pg-line); }
.kb-top-in { height: 100%; display: flex; align-items: center; gap: 14px; }
.kb-logo img { height: 32px; width: auto; display: block; }
.kb-brand { font-family: Manrope, system-ui, sans-serif; font-weight: 700; font-size: 15px; color: var(--pg-primary); text-decoration: none; padding: 4px 10px; border-radius: 8px; background: var(--pg-soft); white-space: nowrap; }
.kb-search { position: relative; flex: 1 1 auto; max-width: 520px; margin: 0 auto; }
.kb-search > .bi { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--pg-muted); }
.kb-search input { width: 100%; height: 40px; border: 1px solid var(--pg-line); border-radius: 12px; background: #f7f6fb; padding: 0 40px 0 38px; font-size: 15px; color: var(--pg-text); outline: none; transition: border-color .15s, background .15s, box-shadow .15s; }
.kb-search input:focus { background: #fff; border-color: var(--pg-primary); box-shadow: 0 0 0 4px rgba(124, 92, 191, .12); }
.kb-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: #fff; color: var(--pg-muted); border: 1px solid var(--pg-line); border-radius: 6px; padding: 1px 7px; font-size: 12px; box-shadow: none; }
.kb-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: min(70vh, 520px); overflow-y: auto; background: #fff; border: 1px solid var(--pg-line); border-radius: 14px; box-shadow: 0 18px 44px rgba(40, 25, 80, .16); padding: 6px; }
.kb-hit { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--pg-text); }
.kb-hit small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--pg-muted); }
.kb-hit b { display: block; font-size: 15px; margin: 1px 0 2px; }
.kb-hit span { display: block; font-size: 13px; color: var(--pg-muted); line-height: 1.45; }
.kb-hit mark { background: #fde68a; padding: 0 1px; border-radius: 3px; color: inherit; }
.kb-hit:hover, .kb-hit.is-on { background: var(--pg-soft); }
.kb-hit-empty { padding: 14px; color: var(--pg-muted); font-size: 14px; }
.kb-top-nav { display: flex; align-items: center; gap: 14px; }
.kb-top-link { color: var(--pg-text); text-decoration: none; font-weight: 500; font-size: 15px; white-space: nowrap; }
.kb-top-link:hover { color: var(--pg-primary); }
.kb-menu-btn { border: 0; background: transparent; font-size: 26px; line-height: 1; padding: 2px 4px; color: var(--pg-text); }

/* главная */
.kb-hero { background: linear-gradient(180deg, #f4f1fb 0%, #fff 100%); border-bottom: 1px solid var(--pg-line); }
.kb-hero-in { max-width: 820px; margin: 0 auto; padding: 64px 20px 54px; text-align: center; }
.kb-hero h1 { font-family: Manrope, system-ui, sans-serif; font-weight: 800; font-size: clamp(30px, 5vw, 46px); letter-spacing: -.02em; color: var(--pg-text); margin: 0 0 12px; }
.kb-hero p { color: var(--pg-muted); font-size: 17px; margin: 0 auto 26px; max-width: 600px; }
.kb-hero-search { display: inline-flex; align-items: center; gap: 10px; width: min(100%, 520px); height: 52px; padding: 0 18px; border: 1px solid var(--pg-line); border-radius: 14px; background: #fff; color: var(--pg-muted); font-size: 16px; box-shadow: 0 10px 30px rgba(40, 25, 80, .08); }
.kb-hero-search:hover { border-color: var(--pg-primary); }
.kb-home { max-width: 1120px; margin: 0 auto; padding: 40px 20px 70px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 20px; }
.kb-sec-card { border: 1px solid var(--pg-line); border-radius: 20px; padding: 22px; background: #fff; }
.kb-sec-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.kb-sec-ico { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--pg-soft); color: var(--pg-primary); font-size: 22px; }
.kb-sec-head h2 { font-family: Manrope, system-ui, sans-serif; font-size: 20px; font-weight: 700; margin: 0 0 2px; }
.kb-sec-head h2 a { color: var(--pg-text); text-decoration: none; }
.kb-sec-head h2 a:hover { color: var(--pg-primary); }
.kb-sec-head p { margin: 0; color: var(--pg-muted); font-size: 14px; }
.kb-sec-list { list-style: none; margin: 0; padding: 0; }
.kb-sec-list a { display: flex; gap: 12px; padding: 10px 10px; margin: 0 -10px; border-radius: 12px; text-decoration: none; color: var(--pg-text); }
.kb-sec-list a:hover { background: var(--pg-soft); }
.kb-sec-list a .bi { color: var(--pg-primary); margin-top: 2px; }
.kb-sec-list b { display: block; font-weight: 600; font-size: 15px; }
.kb-sec-list small { display: block; color: var(--pg-muted); font-size: 13px; line-height: 1.45; }
.kb-help { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 22px; border-radius: 20px; background: #1f1b2d; color: #fff; }
.kb-help > .bi { font-size: 28px; color: #c9b6f2; }
.kb-help div { flex: 1 1 260px; }
.kb-help b { display: block; font-size: 17px; }
.kb-help span { color: #c8c3d8; font-size: 14px; }
.kb-help .btn { background: #fff; color: #1f1b2d; border: 0; font-weight: 600; border-radius: 12px; padding: 10px 20px; }

/* статья: меню — текст — оглавление */
.kb-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; gap: 36px; }
.kb-nav { position: sticky; top: var(--kb-top-h); align-self: start; max-height: calc(100vh - var(--kb-top-h)); overflow-y: auto; padding: 26px 8px 40px 0; border-right: 1px solid var(--pg-line); }
.kb-nav-home { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--pg-muted); text-decoration: none; padding: 6px 10px; margin-bottom: 8px; }
.kb-nav-home:hover { color: var(--pg-primary); }
.kb-nav-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--pg-text); text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.kb-nav-title .bi { color: var(--pg-primary); }
.kb-nav-title.is-on { background: var(--pg-soft); }
.kb-nav-sec ul { list-style: none; padding: 0 0 8px 0; margin: 0 0 6px 17px; border-left: 1px solid var(--pg-line); }
.kb-nav-sec li a { display: block; padding: 6px 12px; margin-left: -1px; border-left: 2px solid transparent; font-size: 14px; color: #4a4560; text-decoration: none; line-height: 1.4; }
.kb-nav-sec li a:hover { color: var(--pg-primary); }
.kb-nav-sec li a.is-on { color: var(--pg-primary); font-weight: 600; border-left-color: var(--pg-primary); background: linear-gradient(90deg, var(--pg-soft), transparent); }

.kb-main { min-width: 0; padding: 30px 0 70px; }
.kb-title { font-family: Manrope, system-ui, sans-serif; font-weight: 800; font-size: clamp(28px, 3.6vw, 38px); letter-spacing: -.02em; line-height: 1.15; color: var(--pg-text); margin: 4px 0 10px; }
html[lang="hy"] .kb-title, html[lang="hy"] .kb-hero h1 { font-family: "Noto Sans Armenian", system-ui, sans-serif; letter-spacing: 0; }
.kb-lead { font-size: 18px; color: #4a4560; margin: 0 0 10px; line-height: 1.5; }
.kb-meta { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--pg-muted); padding-bottom: 20px; margin-bottom: 26px; border-bottom: 1px solid var(--pg-line); }
.kb-cards { display: grid; gap: 12px; margin-top: 24px; }
.kb-card { position: relative; display: block; padding: 18px 48px 18px 20px; border: 1px solid var(--pg-line); border-radius: 16px; text-decoration: none; color: var(--pg-text); transition: border-color .15s, box-shadow .15s; }
.kb-card:hover { border-color: var(--pg-primary); box-shadow: 0 8px 24px rgba(40, 25, 80, .08); }
.kb-card b { display: block; font-size: 17px; }
.kb-card span { display: block; color: var(--pg-muted); font-size: 14px; margin-top: 2px; }
.kb-card .bi { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--pg-primary); }

.kb-toc { position: sticky; top: var(--kb-top-h); align-self: start; max-height: calc(100vh - var(--kb-top-h)); overflow-y: auto; padding: 32px 0 40px; }
.kb-toc-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pg-muted); margin-bottom: 10px; }
.kb-toc ul { list-style: none; margin: 0 0 14px; padding: 0; border-left: 1px solid var(--pg-line); }
.kb-toc li a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13px; line-height: 1.4; color: var(--pg-muted); text-decoration: none; }
.kb-toc li.lvl-3 a { padding-left: 24px; }
.kb-toc li a:hover { color: var(--pg-text); }
.kb-toc li a.is-on { color: var(--pg-primary); border-left-color: var(--pg-primary); font-weight: 600; }
.kb-totop { font-size: 13px; color: var(--pg-muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }

/* текст статьи */
.kb-doc { font-size: 16px; line-height: 1.75; color: #2b2740; overflow-wrap: anywhere; }
.kb-doc > :first-child { margin-top: 0; }
.kb-doc h2 { position: relative; font-family: Manrope, system-ui, sans-serif; font-size: 24px; font-weight: 800; letter-spacing: -.01em; color: var(--pg-text); margin: 44px 0 14px; }
.kb-doc h3 { position: relative; font-size: 18px; font-weight: 700; color: var(--pg-text); margin: 28px 0 8px; }
.kb-anchor { margin-left: 8px; color: #c9c3da; text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .15s; }
.kb-doc h2:hover .kb-anchor, .kb-doc h3:hover .kb-anchor { opacity: 1; }
.kb-doc p { margin: 0 0 14px; }
.kb-doc ul, .kb-doc ol { padding-left: 22px; margin: 0 0 16px; }
.kb-doc li { margin-bottom: 6px; }
.kb-doc a { color: var(--pg-primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(124, 92, 191, .35); }
.kb-doc a:hover { text-decoration-color: currentColor; }
.kb-doc code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: #f3f1f8; border: 1px solid #ebe7f4; border-radius: 6px; padding: 1px 6px; color: #3b2d6b; }
.kb-doc code[data-copy] { cursor: copy; }
.kb-doc code[data-copy]::after { content: "\F759"; font-family: bootstrap-icons; font-size: .9em; margin-left: 6px; color: var(--pg-muted); }
.kb-doc code.is-copied::after { content: "\F26E"; color: #1c7c45; }
.kb-doc strong { color: var(--pg-text); }

/* путь в интерфейсе: «Настройки → Интеграции» */
.kb-ui { display: inline; font-weight: 600; color: var(--pg-text); background: #f7f6fb; border: 1px solid var(--pg-line); border-radius: 7px; padding: 1px 7px; white-space: nowrap; font-size: .94em; }

/* шаги */
.kb-steps { list-style: none; counter-reset: kb; padding: 0; margin: 18px 0 22px; }
.kb-steps > li { counter-increment: kb; position: relative; padding: 0 0 22px 52px; margin: 0; }
.kb-steps > li::before { content: counter(kb); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pg-primary); color: #fff; font-weight: 700; font-size: 15px; }
.kb-steps > li::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--pg-line); }
.kb-steps > li:last-child::after { display: none; }
.kb-steps > li > b:first-child { display: block; font-size: 17px; color: var(--pg-text); margin: 4px 0 4px; }

/* подсказки */
.kb-note { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; margin: 18px 0; background: #f4f1fb; border: 1px solid #e6dff7; font-size: 15px; line-height: 1.6; }
.kb-note > .bi { flex: none; font-size: 18px; color: var(--pg-primary); margin-top: 1px; }
.kb-note p:last-child, .kb-note ul:last-child { margin-bottom: 0; }
.kb-note.is-tip { background: #ecfbf2; border-color: #c9efd8; }
.kb-note.is-tip > .bi { color: #1c7c45; }
.kb-note.is-warn { background: #fff7e6; border-color: #fbe2b0; }
.kb-note.is-warn > .bi { color: #b45309; }
.kb-note.is-danger { background: #fdeeee; border-color: #f6cccc; }
.kb-note.is-danger > .bi { color: #b91c1c; }

/* таблицы и чек-листы */
.kb-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 16px 0 22px; font-size: 15px; border: 1px solid var(--pg-line); border-radius: 14px; overflow: hidden; }
.kb-table th, .kb-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--pg-line); }
.kb-table th { background: #f7f6fb; font-weight: 700; font-size: 13px; color: var(--pg-text); }
.kb-table tr:last-child td { border-bottom: 0; }
.kb-scroll { overflow-x: auto; }
.kb-check { list-style: none; padding: 0; }
.kb-check li { position: relative; padding-left: 30px; }
.kb-check li::before { content: "\F26B"; font-family: bootstrap-icons; position: absolute; left: 0; top: 0; color: #1c7c45; font-size: 18px; }
.kb-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 22px; }
.kb-flow span { padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--pg-line); font-size: 14px; font-weight: 600; }
.kb-flow i { color: var(--pg-muted); }
.kb-related { margin-top: 36px; padding: 18px 20px; border-radius: 16px; background: #f7f6fb; }
.kb-related b { display: block; margin-bottom: 6px; }
.kb-related ul { margin: 0; }

/* снимки экрана */
.kb-shot { margin: 18px 0 26px; }
.kb-shot a { display: block; border: 1px solid var(--pg-line); border-radius: 14px; overflow: hidden; background: #f7f6fb; box-shadow: 0 6px 24px rgba(43, 39, 64, .06); cursor: zoom-in; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.kb-shot a:hover { transform: translateY(-2px); border-color: #ddd6ee; box-shadow: 0 16px 40px rgba(43, 39, 64, .14); }
.kb-shot a:focus-visible { outline: 3px solid rgba(124, 92, 191, .45); outline-offset: 3px; }
.kb-shot img { display: block; width: 100%; height: auto; }
.kb-shot figcaption { margin-top: 8px; font-size: 13px; color: var(--pg-muted); text-align: center; }

/* просмотр снимка на весь экран (docs.js) */
html.kb-lb-lock { overflow: hidden; }
.kb-lb { position: fixed; inset: 0; z-index: 1080; outline: none; -webkit-tap-highlight-color: transparent; }
.kb-lb[hidden], .kb-lb [hidden] { display: none !important; }
.kb-lb::before { content: ""; position: absolute; inset: 0; background: rgba(17, 14, 30, .84); -webkit-backdrop-filter: blur(12px) saturate(120%); backdrop-filter: blur(12px) saturate(120%); opacity: 0; transition: opacity .3s ease; }
.kb-lb.is-open::before { opacity: var(--kb-lb-fade, 1); }
.kb-lb-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.kb-lb-img { position: absolute; max-width: none; transform-origin: 50% 50%; border-radius: 10px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); will-change: transform; -webkit-user-drag: none; }
.kb-lb-img.is-anim { transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .25s ease; }
.kb-lb.can-zoom .kb-lb-img { cursor: zoom-in; }
.kb-lb.is-zoomed .kb-lb-img { cursor: grab; border-radius: 0; }
.kb-lb.is-zoomed .kb-lb-img:active { cursor: grabbing; }
.kb-lb-top, .kb-lb-nav, .kb-lb-cap { opacity: 0; transition: opacity .25s ease; }
.kb-lb.is-open .kb-lb-top, .kb-lb.is-open .kb-lb-nav, .kb-lb.is-open .kb-lb-cap { opacity: 1; }
.kb-lb.is-zoomed .kb-lb-nav, .kb-lb.is-zoomed .kb-lb-cap { opacity: 0; pointer-events: none; }
.kb-lb-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left)); pointer-events: none; }
.kb-lb-top > * { pointer-events: auto; }
.kb-lb-count { margin-right: auto; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kb-lb-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; font-size: 19px; line-height: 1; transition: background .15s ease, transform .15s ease; }
.kb-lb-btn:hover { background: rgba(255, 255, 255, .24); }
.kb-lb-btn:active { transform: scale(.94); }
.kb-lb-btn:focus-visible { outline: 2px solid #c9b6f2; outline-offset: 2px; }
.kb-lb-nav { position: absolute; top: 50%; width: 52px; height: 52px; margin-top: -26px; font-size: 22px; }
.kb-lb-prev { left: calc(20px + env(safe-area-inset-left)); }
.kb-lb-next { right: calc(20px + env(safe-area-inset-right)); }
.kb-lb-cap { position: absolute; left: 50%; width: min(760px, calc(100vw - 24px)); margin: 0; transform: translateX(-50%); color: rgba(255, 255, 255, .88); font-size: 14px; line-height: 1.5; text-align: center; pointer-events: none; }
@media (max-width: 767.98px) {
    .kb-lb-nav { display: none; }
    .kb-lb-cap { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    .kb-shot a, .kb-lb::before, .kb-lb-img.is-anim, .kb-lb-top, .kb-lb-nav, .kb-lb-cap, .kb-lb-btn { transition: none; }
    .kb-shot a:hover { transform: none; }
}

/* назад / далее */
.kb-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--pg-line); }
.kb-pager a { display: block; padding: 14px 18px; border: 1px solid var(--pg-line); border-radius: 14px; text-decoration: none; color: var(--pg-text); }
.kb-pager a:hover { border-color: var(--pg-primary); }
.kb-pager small { display: flex; gap: 6px; align-items: center; color: var(--pg-muted); font-size: 13px; }
.kb-pager b { display: block; font-size: 15px; margin-top: 2px; }
.kb-pager-next { text-align: right; grid-column: 2; }
.kb-pager-next small { justify-content: flex-end; }

@media (max-width: 1199.98px) {
    .kb-layout { grid-template-columns: 250px minmax(0, 1fr); }
    .kb-toc { display: none; }
}
@media (max-width: 991.98px) {
    .kb-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .kb-nav { position: fixed; left: 0; top: var(--kb-top-h); bottom: 0; z-index: 25; width: min(320px, 86vw); max-height: none; background: #fff; padding: 18px 14px 40px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(20, 16, 35, .18); }
    .kb-nav.is-open { transform: none; }
    .kb-brand { display: none; }
}
@media (max-width: 575.98px) {
    .kb-top-in { gap: 10px; }
    .kb-logo img { height: 26px; }
    .kb-search input { height: 38px; font-size: 14px; }
    .kb-pager { grid-template-columns: 1fr; }
    .kb-pager-next { grid-column: 1; }
    .kb-steps > li { padding-left: 46px; }
}
