:root {
  --bg: #f7f6fa; --surface: #fff; --line: #ebe8f1; --line-2: #ddd8e7; --text: #1b1530; --muted: #6b6580; --faint: #9a94ad;
  --accent: #6a4cff; --accent-2: #5636f0; --accent-soft: #efebff; --ok: #12a150; --ok-soft: #e7f6ed; --warn: #9a5b00; --warn-soft: #fff4df;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Manrope, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); font-size: 16.5px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); }
img { max-width: 100%; }

/* Шапка */
.kb-top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.kb-top-in { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 20px; }
.kb-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; color: var(--text); text-decoration: none; font-size: 17px; }
.kb-brand i { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-style: normal; color: #fff; background: linear-gradient(135deg, #8a6bff, #4f2fe8); }
.kb-home { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; padding-left: 14px; border-left: 1px solid var(--line-2); }
.kb-search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.kb-search input { width: 100%; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; font: inherit; font-size: 15px; background: #fff; outline: none; }
.kb-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kb-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(30,20,70,.16); max-height: 420px; overflow: auto; padding: 6px; }
.kb-results a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); }
.kb-results a:hover, .kb-results a.on { background: var(--accent-soft); }
.kb-results small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }
.kb-results mark { background: #ffe58a; color: inherit; border-radius: 3px; }
.kb-results .empty { padding: 12px; color: var(--muted); font-size: 14px; }
.kb-cta { background: var(--accent); color: #fff; text-decoration: none; font-weight: 800; padding: 10px 16px; border-radius: 12px; font-size: 14px; white-space: nowrap; }
.kb-menu { display: none; border: 0; background: var(--accent-soft); color: var(--accent-2); width: 40px; height: 40px; border-radius: 10px; font-size: 18px; cursor: pointer; }

/* Каркас */
.kb-wrap { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 36px; padding: 28px 20px 40px; }
.kb-side { position: sticky; top: 78px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; padding-right: 6px; }
.nav-sec { margin-bottom: 14px; }
.nav-sec-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 6px 10px; }
.kb-side ul { list-style: none; margin: 0; padding: 0; }
.kb-side li a { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 9px; text-decoration: none; color: var(--text); font-size: 14.5px; line-height: 1.4; font-weight: 600; }
.kb-side li a:hover { background: #fff; }
.kb-side li a.on { background: var(--accent-soft); color: var(--accent-2); }
.nav-num { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 800; transform: translateY(2px); }
.kb-main { min-width: 0; }

/* Главная базы */
.kb-hero { background: radial-gradient(circle at 85% 0%, #ffd9c7 0, transparent 40%), linear-gradient(135deg, #6a4cff, #8f6bff); color: #fff; border-radius: 24px; padding: 40px 40px 36px; margin-bottom: 26px; }
.kb-hero h1 { margin: 0 0 8px; font-size: 38px; line-height: 1.15; letter-spacing: -.02em; }
.kb-hero p { margin: 0; font-size: 18px; opacity: .92; max-width: 680px; }
.kb-course { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 26px; margin-bottom: 30px; }
.kb-course-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.kb-course h2 { margin: 6px 0 4px; font-size: 26px; }
.kb-course p { margin: 0; color: var(--muted); max-width: 640px; }
.kb-badge { display: inline-block; background: var(--accent-soft); color: var(--accent-2); font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 99px; }
.kb-btn { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; font-weight: 800; padding: 12px 20px; border-radius: 12px; white-space: nowrap; }
.kb-lessons { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.kb-lessons a { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; height: 100%; }
.kb-lessons a:hover { border-color: var(--accent); transform: translateY(-2px); }
.kb-lessons b { display: block; line-height: 1.3; }
.kb-lessons small { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.4; margin-top: 3px; }
.kb-num { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; }
.kb-sec { margin-bottom: 30px; }
.kb-sec h2 { font-size: 22px; margin: 0 0 2px; }
.kb-sec-text { margin: 0 0 12px; color: var(--muted); }
.kb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.kb-card { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.kb-card:hover { border-color: var(--accent); box-shadow: 0 8px 24px rgba(40,20,90,.08); }
.kb-card b { line-height: 1.3; }
.kb-card span { color: var(--muted); font-size: 14px; line-height: 1.45; }

/* Статья */
.kb-crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.kb-crumbs a { color: var(--muted); }
.kb-article { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 34px 40px; max-width: 900px; }
.kb-article h1 { font-size: 34px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.02em; }
.kb-lead { font-size: 19px; color: var(--muted); margin: 0 0 24px; }
.kb-article h2 { font-size: 24px; margin: 34px 0 10px; line-height: 1.25; scroll-margin-top: 80px; }
.kb-article h3 { font-size: 19px; margin: 26px 0 8px; }
.kb-article p { margin: 0 0 14px; }
.kb-article ul, .kb-article ol { padding-left: 24px; margin: 0 0 16px; }
.kb-article li { margin: 6px 0; }
.kb-article ol > li::marker { font-weight: 800; color: var(--accent-2); }
.kb-article code { background: #f2f0f7; padding: 2px 6px; border-radius: 6px; font-size: .92em; }
.kb-article table { border-collapse: collapse; width: 100%; margin: 0 0 18px; font-size: 15px; }
.kb-article th, .kb-article td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
.kb-article th { background: #faf9fc; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kb-article blockquote { margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; }
.ui-btn { display: inline-block; background: var(--accent); color: #fff; font-weight: 800; font-size: .86em; padding: 1px 10px; border-radius: 8px; white-space: nowrap; line-height: 1.6; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.shot { margin: 18px 0 24px; }
.shot a { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(30,20,70,.12); cursor: zoom-in; background: #fff; }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { font-size: 14px; color: var(--muted); text-align: center; margin-top: 8px; }
.shot.phone { max-width: 360px; margin-left: auto; margin-right: auto; }
.callout { border-radius: 14px; padding: 14px 18px; margin: 18px 0; border: 1px solid; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout-title { font-weight: 800; margin-bottom: 4px; }
.callout.tip { background: var(--ok-soft); border-color: #bfe5cd; }
.callout.warn { background: var(--warn-soft); border-color: #f4d79c; }
.callout.info { background: var(--accent-soft); border-color: #d9d0ff; }
.callout.kid { background: #fff0f5; border-color: #ffc9dc; }

/* Нарисованный чат */
.chat { max-width: 440px; margin: 18px auto 24px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line-2); box-shadow: 0 14px 40px rgba(30,20,70,.12); background: #fff; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #f4f6f9; border-bottom: 1px solid var(--line); }
.chat-ava { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #4fb7f0, #2a8fd4); color: #fff; display: grid; place-items: center; font-weight: 800; }
.chat-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; background: #dfe9f3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1.2' fill='%23c9d7e6'/%3E%3C/svg%3E"); }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg.you { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 8px 12px; border-radius: 14px; font-size: 15px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.08); word-break: break-word; }
.msg.bot .bubble { background: #fff; border-bottom-left-radius: 4px; }
.msg.you .bubble { background: #e3fbd3; border-bottom-right-radius: 4px; }
.bubble code { background: #eef2f6; }
.msg-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-btns span { background: rgba(255,255,255,.75); border-radius: 10px; padding: 6px 12px; font-size: 14px; font-weight: 700; color: #2a6ea8; }
.chat-note { align-self: center; background: rgba(0,0,0,.18); color: #fff; font-size: 12.5px; padding: 3px 10px; border-radius: 99px; text-align: center; }

/* Урок: прогресс и навигация */
.kb-lesson-bar { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 800; color: var(--accent-2); margin-bottom: 10px; }
.kb-progress { flex: 1; max-width: 220px; height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.kb-progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.kb-pager { display: flex; justify-content: space-between; gap: 12px; margin: 20px 0; max-width: 900px; flex-wrap: wrap; }
.kb-pager a { flex: 1; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; text-decoration: none; font-weight: 700; color: var(--text); }
.kb-pager a:hover { border-color: var(--accent); }
.kb-pager .kb-next { text-align: right; background: var(--accent); color: #fff; border-color: var(--accent); }
.kb-related { max-width: 900px; margin-top: 26px; }
.kb-related h3 { font-size: 18px; }
.kb-help-more { color: var(--muted); font-size: 14px; max-width: 900px; margin-top: 22px; }
.kb-foot { text-align: center; color: var(--muted); font-size: 14px; padding: 26px 20px 40px; }
.kb-foot a { color: var(--muted); }

/* Увеличение скриншота */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(15,10,30,.85); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.lightbox[hidden] { display: none; }

@media (max-width: 980px) {
  .kb-wrap { grid-template-columns: 1fr; padding-top: 16px; }
  .kb-menu { display: inline-grid; place-items: center; }
  .kb-side { position: fixed; top: 61px; left: 0; bottom: 0; width: 300px; max-height: none; background: var(--bg); z-index: 30; padding: 16px; box-shadow: 10px 0 40px rgba(0,0,0,.12); transform: translateX(-105%); transition: transform .2s; }
  body.menu-open .kb-side { transform: none; }
  .kb-home { display: none; }
  .kb-article { padding: 24px 20px; border-radius: 18px; }
  .kb-article h1 { font-size: 27px; }
  .kb-hero { padding: 28px 22px; }
  .kb-hero h1 { font-size: 29px; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .kb-top-in { gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
  .kb-search { order: 9; max-width: none; flex-basis: 100%; }
  .kb-cta { margin-left: auto; padding: 8px 12px; }
  .kb-side { top: 103px; }
  .kb-wrap { padding: 14px 12px 30px; }
}

/* Чек-листы «- [ ]» */
.kb-article li:has(> input[type="checkbox"]) { list-style: none; margin-left: -22px; }
.kb-article li > input[type="checkbox"] { margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--accent); }
