/* Help-centre layout on top of theme.css. Phone first: one column, 44px targets, 16px inputs. */

.kb-shell { max-width: 760px; margin: 0 auto; }
.kb-main { max-width: 760px; margin: 0 auto; padding-bottom: calc(40px + var(--sab, 0px)); }

/* side menu: a drawer on a phone, a column on a wide screen. All lists closed by default. */
.kb-nav-toggle {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  min-height: 40px; padding: 8px 12px; cursor: pointer;
  background: var(--card); color: var(--text-body);
  border: .5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-weight: 500; font-family: inherit;
  transition: color 100ms ease, border-color 100ms ease, transform 100ms ease;
}
.kb-nav-toggle svg { width: 18px; height: 18px; }
.kb-nav-toggle:hover { color: var(--primary); border-color: var(--border-strong); }
.kb-nav-toggle:active { transform: scale(.97); }
.kb-nav-toggle:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.kb-nav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  width: min(320px, 86vw); overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 14px calc(24px + var(--sab, 0px));
  background: var(--surface); border-right: .5px solid var(--border);
  transform: translateX(-102%); transition: transform 200ms ease;
}
.kb-nav.is-open { transform: translateX(0); }
.kb-nav-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(13,15,20,.45); opacity: 0; transition: opacity 200ms ease;
}
.kb-nav-backdrop.is-open { opacity: 1; }
.kb-nav-backdrop[hidden] { display: none; }
body.kb-no-scroll { overflow: hidden; }

.kb-nav-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.kb-nav-title {
  margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.kb-nav-close {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; background: transparent; color: var(--text-secondary);
  border: none; border-radius: var(--radius);
}
.kb-nav-close svg { width: 20px; height: 20px; }
.kb-nav-close:active { transform: scale(.97); }

.kb-nav-sec { border-bottom: .5px solid var(--border-subtle); }
.kb-nav-sec > summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 2px;
  cursor: pointer; list-style: none; color: var(--text-heading); font-size: 14px; font-weight: 550;
}
.kb-nav-sec > summary::-webkit-details-marker { display: none; }
.kb-nav-sec > summary:hover { color: var(--primary); }
.kb-nav-sec > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.kb-nav-chevron {
  width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-tertiary);
  transition: transform 150ms ease;
}
.kb-nav-sec[open] > summary .kb-nav-chevron { transform: rotate(90deg); }
.kb-nav-sechref { color: inherit; text-decoration: none; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.kb-nav-sec em { font-style: normal; font-size: 12px; color: var(--text-tertiary); flex: 0 0 auto; }
.kb-nav-root { list-style: none; margin: 0; padding: 0; }
.kb-nav-sec > ul {
  list-style: none; margin: 0 0 10px; padding: 0 0 0 14px;
  display: grid; gap: 2px; border-left: .5px solid var(--border);
}
/* A leaf — an article with nothing under it. */
.kb-nav-leaf > a {
  display: block; padding: 9px 8px; min-height: 24px;
  color: var(--text-body); text-decoration: none; font-size: 14px; line-height: 1.35;
  border-radius: 6px; overflow-wrap: anywhere;
}
.kb-nav-leaf > a:hover { color: var(--primary); background: var(--accent); }
.kb-nav-leaf > a.is-current,
.kb-nav-sechref.is-current { color: var(--primary); font-weight: 600; }
.kb-nav-leaf > a:focus-visible,
.kb-nav-sechref:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
/* Nested branches: the deeper the level, the lighter the row — the same control, less weight. */
.kb-nav-branch .kb-nav-sec { border-bottom: none; }
.kb-nav-lvl2 > summary, .kb-nav-lvl3 > summary { font-weight: 500; font-size: 14px; min-height: 40px; }
.kb-nav-lvl3 > summary { color: var(--text-body); }
.kb-nav-lvl2 > ul, .kb-nav-lvl3 > ul { margin-bottom: 4px; }
.kb-lead { color: var(--text-secondary); margin: 4px 0 16px; }
.kb-h2 { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-tertiary); margin: 22px 0 8px; }
.kb-title { font-size: 22px; line-height: 1.25; font-weight: 650; color: var(--text-heading); margin: 10px 0 6px; }

.kb-sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.kb-sections a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 10px 14px; text-decoration: none;
  background: var(--card); border: .5px solid var(--border); border-radius: var(--radius);
  color: var(--text-body); font-weight: 500;
}
.kb-sections a:active { transform: scale(.99); }
.kb-sections em { font-style: normal; color: var(--text-tertiary); font-size: 13px; }

.kb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kb-item { background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kb-item > a { display: block; min-height: 24px; color: var(--text-heading); font-weight: 550; text-decoration: none; overflow-wrap: anywhere; }
.kb-item > a:hover { color: var(--primary); }
.kb-readtime { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 12px; }
.kb-excerpt { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; }
.kb-item mark { background: rgba(32,162,199,.22); color: inherit; border-radius: 3px; padding: 0 2px; }

.kb-crumbs { margin: 14px 0 0; font-size: 13px; color: var(--text-tertiary); overflow-wrap: anywhere; }
.kb-crumbs a { color: var(--text-secondary); text-decoration: none; }
.kb-crumbs a:hover { color: var(--primary); }
.kb-crumbs span { margin: 0 2px; }

.kb-meta { color: var(--text-tertiary); font-size: 13px; margin: 0 0 14px; }
.kb-toc { background: var(--surface); border: .5px solid var(--border-subtle); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 18px; }
.kb-toc p { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); }
.kb-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.kb-toc li.lvl3 { padding-left: 14px; }
.kb-toc a { color: var(--text-body); text-decoration: none; font-size: 14px; }
.kb-toc a:hover { color: var(--primary); }

.kb-body { color: var(--text-body); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.kb-body h2 { font-size: 18px; color: var(--text-heading); margin: 26px 0 8px; scroll-margin-top: 16px; }
.kb-body h3 { font-size: 16px; color: var(--text-heading); margin: 20px 0 6px; scroll-margin-top: 16px; }
.kb-body p { margin: 0 0 12px; }
.kb-body ul, .kb-body ol { margin: 0 0 12px; padding-left: 22px; }
.kb-body li { margin: 4px 0; }
.kb-body a { color: var(--primary); }
.kb-body img { max-width: 100%; height: auto; border-radius: var(--radius); border: .5px solid var(--border-subtle); margin: 8px 0; }
.kb-body pre { background: var(--surface); border: .5px solid var(--border-subtle); border-radius: var(--radius); padding: 12px; overflow-x: auto; }
.kb-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.kb-body blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--primary); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.kb-body table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.kb-body th, .kb-body td { border: .5px solid var(--border); padding: 8px 10px; text-align: left; font-size: 14px; }
.kb-body hr { border: none; border-top: .5px solid var(--border); margin: 20px 0; }

.kb-feedback { margin: 26px 0 0; padding: 14px; background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); }
.kb-feedback p { margin: 0 0 10px; color: var(--text-secondary); }
.kb-feedback-buttons { display: flex; gap: 8px; }
.kb-feedback-buttons .btn { min-height: 44px; min-width: 88px; }

.kb-related { margin-top: 10px; }

/* jump-to-top / jump-to-bottom, article page only */
.kb-jump {
  position: fixed; right: 12px; bottom: calc(16px + var(--sab, 0px));
  display: flex; flex-direction: column; gap: 8px; z-index: 20;
}
.kb-jump.is-hidden, .kb-jump-btn.is-hidden { display: none; }
.kb-jump-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer;
  background: var(--card); color: var(--text-secondary);
  border: .5px solid var(--border); border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  transition: transform 100ms ease, color 100ms ease, border-color 100ms ease;
}
.kb-jump-btn svg { width: 22px; height: 22px; }
.kb-jump-btn:hover { color: var(--primary); border-color: var(--border-strong); }
.kb-jump-btn:active { transform: scale(.97); }
.kb-jump-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.dark .kb-jump-btn { box-shadow: none; }
/* page footer: contacts centred, previous article left, next article right */
.kb-footer {
  max-width: 760px; margin: 24px auto 0;
  padding: 18px 0 calc(72px + var(--sab, 0px));
  border-top: .5px solid var(--border);
  text-align: center; color: var(--text-secondary); font-size: 14px;
}
.kb-footer-info p { margin: 0 0 8px; }
.kb-footer-info p:last-child { margin-bottom: 0; }
.kb-footer-info strong { color: var(--text-heading); }
.kb-footer-nav { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.kb-footer-link {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 14px; text-decoration: none;
  background: var(--card); border: .5px solid var(--border); border-radius: var(--radius);
  color: var(--text-body); font-weight: 500; overflow-wrap: anywhere;
  transition: color 100ms ease, border-color 100ms ease, transform 100ms ease;
}
.kb-footer-link:hover { color: var(--primary); border-color: var(--border-strong); }
.kb-footer-link:active { transform: scale(.97); }
.kb-footer-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.kb-footer-arrow { color: var(--text-tertiary); }
.kb-footer-spacer { display: none; }

.kb-empty { text-align: center; padding: 48px 12px; }
.kb-empty h1 { font-size: 20px; }

/* settings */
.kb-label { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 600; color: var(--text-heading); }
.kb-label.kb-sub { font-weight: 500; color: var(--text-secondary); }
.kb-hint { margin: 6px 0 0; font-size: 13px; color: var(--text-tertiary); }
.kb-ok { color: var(--primary); font-weight: 500; }
.kb-checks { display: grid; gap: 8px; }
.kb-checks label, .kb-check-inline { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text-body); }
.kb-checks input, .kb-check-inline input { width: 18px; height: 18px; accent-color: var(--primary); }
.kb-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.kb-actions .btn { min-height: 44px; }
.kb-state { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--text-body); font-size: 14px; }
.input { font-size: 16px; }

/* editor (admins only, /settings/edit*) — never rendered on the public site */
.kb-admin { max-width: 760px; }
.kb-admin-wide { max-width: 900px; }
.kb-admin-crumbs { margin: 16px 0 6px; font-size: 13px; color: var(--text-tertiary); overflow-wrap: anywhere; }
.kb-admin-crumbs a { color: var(--text-secondary); text-decoration: none; }
.kb-admin-crumbs a:hover { color: var(--primary); }
.kb-admin-crumbs span { margin: 0 2px; }
.kb-admin-error { color: var(--destructive); margin: 0; }
.kb-admin-new-row { display: flex; gap: 8px; flex-wrap: wrap; }
.kb-admin-new-row .input { flex: 1 1 220px; min-width: 0; }
.kb-admin-new-row .btn { flex: 0 0 auto; min-height: 44px; }
.kb-admin-filter { margin: 18px 0 10px; }
.kb-admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kb-admin-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: .5px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px;
}
.kb-admin-row[hidden] { display: none; }
.kb-admin-row-main { flex: 1 1 200px; min-width: 0; }
.kb-admin-row-title {
  display: block; min-height: 24px; color: var(--text-heading); font-weight: 550;
  text-decoration: none; overflow-wrap: anywhere;
}
.kb-admin-row-title:hover { color: var(--primary); }
.kb-admin-row-meta { margin: 2px 0 0; font-size: 13px; color: var(--text-tertiary); }
.kb-admin-flag { color: var(--destructive); }
.kb-admin-row-view {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--text-secondary); text-decoration: none; font-size: 14px;
  border: .5px solid var(--border); border-radius: var(--radius);
}
.kb-admin-row-view:hover { color: var(--primary); border-color: var(--border-strong); }
.kb-admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.kb-admin-tab {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: .5px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 550;
}
.kb-admin-tab:hover { color: var(--primary); border-color: var(--border-strong); }
.kb-admin-tab.is-current { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.kb-admin .kb-article { margin-top: 8px; }
.kb-admin-h2 { margin: 0 0 8px; font-size: 17px; color: var(--text-heading); }
.kb-admin-notes { margin: 8px 0 0; padding-left: 18px; font-size: 13px; overflow-wrap: anywhere; }
.kb-admin-notes li { margin: 2px 0; }
.kb-transfer-form { margin-top: 8px; }
.kb-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.kb-check input { width: 20px; height: 20px; accent-color: var(--primary); }
.kb-file { width: 100%; max-width: 100%; padding: 10px; min-height: 44px; }
.kb-progress { width: 100%; height: 10px; accent-color: var(--primary); }

.kb-ed { margin-top: 8px; }
.kb-ed-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.kb-ed-tool {
  min-height: 44px; min-width: 44px; padding: 0 10px; cursor: pointer;
  background: var(--card); color: var(--text-body);
  border: .5px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: 14px; font-weight: 500;
  transition: color 100ms ease, border-color 100ms ease, transform 100ms ease;
}
.kb-ed-tool:hover { color: var(--primary); border-color: var(--border-strong); }
.kb-ed-tool:active { transform: scale(.97); }
.kb-ed-tool:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.kb-ed-tool:disabled { opacity: .4; cursor: default; pointer-events: none; }
.kb-ed-linkrow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.kb-ed-linkrow[hidden] { display: none; }
.kb-ed-linkrow .input { flex: 1 1 200px; min-width: 0; }
.kb-ed-linkrow .btn { min-height: 44px; }
/* LIVE LINKS (v28): the «Ссылка» box — article picker | external address */
.kb-ed-linkbox { display: grid; gap: 8px; margin-bottom: 8px; padding: 10px; background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); }
.kb-ed-linkbox[hidden], .kb-ed-linkpane[hidden] { display: none; }
.kb-ed-linkbox .kb-ed-linkrow { margin: 0; }
.kb-ed-linkpane { display: grid; gap: 6px; }
.kb-seg { display: flex; gap: 4px; padding: 3px; background: var(--surface); border: .5px solid var(--border); border-radius: var(--radius); }
.kb-seg-btn { flex: 1 1 0; min-height: 40px; padding: 6px 10px; border: 0; border-radius: calc(var(--radius) - 2px); background: transparent; color: var(--text-secondary); font: inherit; font-size: 14px; cursor: pointer; }
.kb-seg-btn.is-on { background: var(--card); color: var(--text-heading); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.kb-seg-btn:active { transform: scale(.97); }
.kb-ed-linklist { list-style: none; margin: 0; padding: 0; max-height: 40dvh; overflow-y: auto; border: .5px solid var(--border); border-radius: var(--radius); }
.kb-ed-linklist:empty { display: none; }
.kb-ed-linkitem { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-bottom: .5px solid var(--border); background: transparent; color: var(--text-body); font: inherit; text-align: left; cursor: pointer; }
.kb-ed-linklist li:last-child .kb-ed-linkitem { border-bottom: 0; }
.kb-ed-linkitem:hover, .kb-ed-linkitem:focus-visible { background: var(--surface); color: var(--primary); outline: none; }
.kb-ed-linkoff { color: var(--destructive); font-size: 13px; }
.kb-ed-linkcancel { justify-self: start; min-height: 44px; }
.kb-broken-filter { margin: 8px 0 0; }
/* live links in article text: external ↗, dead links (site: plain text, editor: red with the reason) */
.kb-body a.kb-ext::after, .kb-ed-area a.kb-ext::after, .kb-article a.kb-ext::after { content: " ↗"; font-size: .85em; }
.kb-dead-link { color: inherit; }
a.kb-link-bad { color: var(--destructive); text-decoration: underline wavy; text-underline-offset: 3px; }
a.kb-link-bad::after { content: " (" attr(data-kb-state) ")"; font-size: .85em; }
.kb-ed-area {
  min-height: 50vh; padding: 14px; overflow-wrap: anywhere;
  background: var(--card); border: .5px solid var(--input); border-radius: var(--radius);
}
.kb-ed-area:focus { outline: 2px solid var(--ring); outline-offset: 1px; }

@media (min-width: 720px) {
  .kb-title { font-size: 26px; }
  .kb-footer-nav { flex-direction: row; align-items: stretch; gap: 12px; }
  .kb-footer-link { flex: 0 1 48%; }
  .kb-footer-prev { justify-content: flex-start; text-align: left; }
  .kb-footer-next { justify-content: flex-end; text-align: right; margin-left: auto; }
  .kb-footer-spacer { display: block; flex: 0 1 48%; }
}

@media (min-width: 1024px) {
  .kb-footer { max-width: 1060px; }
  .kb-shell {
    max-width: 1060px; display: grid; gap: 28px;
    grid-template-columns: 250px minmax(0, 1fr); align-items: start;
  }
  .kb-nav {
    position: sticky; top: 16px; bottom: auto; left: auto; z-index: 1;
    width: auto; max-height: calc(100vh - 48px);
    padding: 0 8px 0 0; background: transparent;
    border-right: none; transform: none; transition: none;
  }
  .kb-nav-top { margin-bottom: 4px; }
  .kb-nav-close, .kb-nav-toggle, .kb-nav-backdrop { display: none; }
  .kb-main { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Glossary editor (closed part) */
.kb-gl-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.kb-gl-row { display: grid; gap: 6px; padding: 12px; border: .5px solid var(--border); border-radius: var(--radius); background: var(--card); }
.kb-gl-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kb-gl-term { flex: 1 1 180px; min-width: 0; font-weight: 600; }
.kb-gl-del { min-height: 40px; font-size: 13px; color: var(--text-secondary); }
.kb-gl-def { resize: vertical; min-height: 64px; }

/* Backlinks (v17) — editor only: who links here / where this article links to. */
.kb-rel { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 20px 0 8px; }
@media (min-width: 768px) { .kb-rel { grid-template-columns: 1fr 1fr; } }
.kb-rel-col { min-width: 0; background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kb-rel-h { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--text-heading); }
.kb-rel-list { list-style: none; margin: 0; padding: 0; }
.kb-rel-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 0; border-top: .5px solid var(--border-subtle); }
.kb-rel-item:first-child { border-top: 0; }
.kb-rel-title { flex: 1 1 180px; min-width: 0; min-height: 28px; display: inline-flex; align-items: center; color: var(--text-heading); text-decoration: none; overflow-wrap: anywhere; font-size: 14px; }
a.kb-rel-title:hover { color: var(--primary); }
.kb-rel-ok { font-size: 13px; color: var(--text-tertiary); }
.kb-rel-item .kb-admin-flag { font-size: 13px; }
.kb-rel-warn { margin: 0 0 6px; font-size: 13px; }
.kb-rel-none { color: var(--text-placeholder); }

/* Auto contents (tocBlock): <details> on a phone, a sticky side column on a wide article page */
.kb-toc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); }
.kb-toc > summary::-webkit-details-marker { display: none; }
.kb-toc > summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.kb-toc[open] > summary::after { transform: rotate(-135deg); }
.kb-toc-n { font-variant-numeric: tabular-nums; opacity: .8; }
.kb-toc nav { margin-top: 6px; }
.kb-toc li.lvl4 { padding-left: 28px; }
.kb-toc li a { display: block; padding: 3px 0 3px 8px; border-left: 2px solid transparent; line-height: 1.35; }
.kb-toc li a[aria-current="true"] { border-left-color: var(--primary); color: var(--primary); font-weight: 600; }
.kb-body [id] { scroll-margin-top: 16px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* Article history (v19) — editor only: versions, comparison, restore. */
.kb-hist-list { list-style: none; margin: 12px 0; padding: 0; background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); }
.kb-hist-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 10px; padding: 10px 12px; border-top: .5px solid var(--border-subtle); }
.kb-hist-row:first-child { border-top: 0; }
.kb-hist-pick { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -8px 0 -8px -10px; }
.kb-hist-pick input { width: 18px; height: 18px; accent-color: var(--primary); }
.kb-hist-main { flex: 1 1 200px; min-width: 0; }
.kb-hist-when { color: var(--text-heading); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.kb-hist-when:hover { color: var(--primary); }
.kb-hist-cur { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--sidebar-accent, var(--muted)); color: var(--primary); }
.kb-hist-meta { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.kb-hist-cmp { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--primary); text-decoration: none; }
.kb-hist-imgs { margin: 0 0 16px; padding-left: 18px; font-size: 14px; overflow-wrap: anywhere; }
.kb-hist-imgs li { padding: 4px 0; }
.kb-hist-raw { margin: 16px 0; }
.kb-hist-raw > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--text-secondary); }
.kb-hist-src { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; line-height: 1.45; resize: vertical; }
.kb-inline { display: inline; margin: 0; }
.kb-hist-legend { font-size: 13px; color: var(--text-secondary); }
.kb-diff-plus { color: var(--primary); font-weight: 600; }
.kb-diff-minus { color: var(--destructive); font-weight: 600; }
.kb-diff-ins { text-decoration: none; background: color-mix(in srgb, green 22%, transparent); color: var(--text-heading); border-radius: 3px; padding: 0 2px; }
.kb-diff-del { text-decoration: line-through; background: color-mix(in srgb, var(--destructive) 20%, transparent); color: var(--text-heading); border-radius: 3px; padding: 0 2px; }
.kb-diff-title { overflow-wrap: anywhere; }
.kb-diff-head { margin: 0 0 8px; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.kb-diff-body { font-size: 15px; line-height: 1.55; color: var(--text-body); overflow-wrap: anywhere; }
.kb-diff-body p { margin: 0 0 8px; white-space: pre-wrap; }
.kb-diff-body p:not(.kb-diff-chg) { color: var(--text-tertiary); }
.kb-diff-chg { border-left: 3px solid var(--primary); padding-left: 8px; }
.kb-diff-grid { display: none; }
.kb-diff-inline, .kb-diff-col { background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; min-width: 0; }
@media (min-width: 900px) {
  .kb-diff-inline { display: none; }
  .kb-diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ---- file library (v20) ---- */
.kb-body video { display: block; width: 100%; max-width: 100%; height: auto; border-radius: var(--radius); border: .5px solid var(--border-subtle); background: var(--muted); margin: 8px 0; }
.kb-body a[href^="/media/files/"] { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border: .5px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; overflow-wrap: anywhere; }
.kb-body a[href^="/media/files/"]:hover { border-color: var(--border-strong); }
.kb-offscreen { position: fixed; left: -9999px; top: 0; }
.kb-drop { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 18px 14px; margin: 0 0 14px; text-align: center; transition: border-color .15s, background .15s; }
.kb-drop.is-over { border-color: var(--primary); background: var(--accent); }
.kb-drop-text { margin: 0 0 10px; color: var(--text-secondary); }
.kb-drop-btn { min-height: 44px; }
.kb-up-list { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; display: grid; gap: 8px; }
.kb-up { display: grid; gap: 4px; }
.kb-up-name { font-size: 14px; color: var(--text-body); overflow-wrap: anywhere; }
.kb-up.is-error .kb-hint { color: var(--destructive); }
.kb-file-search { display: flex; gap: 8px; margin: 0 0 8px; }
.kb-file-search .input { flex: 1; min-width: 0; }
.kb-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 720px) { .kb-files { grid-template-columns: 1fr 1fr; } }
.kb-file { display: flex; gap: 12px; min-width: 0; background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); padding: 10px; }
.kb-file-open { flex: none; }
.kb-file-thumb { width: 72px; height: 72px; border-radius: calc(var(--radius) - 2px); object-fit: cover; background: var(--muted); border: .5px solid var(--border-subtle); }
.kb-file-ext { display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--text-secondary); background: var(--muted); border-radius: calc(var(--radius) - 2px); }
span.kb-file-thumb.kb-file-ext { width: 72px; height: 72px; }
.kb-file-info { min-width: 0; flex: 1; }
.kb-file-name { margin: 0; font-weight: 600; color: var(--text-heading); overflow-wrap: anywhere; }
.kb-file-info .kb-hint { margin: 2px 0 0; }
.kb-file-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: flex-start; }
.kb-file-actions .btn { min-height: 44px; }
.kb-file-more { flex: 1 1 100%; }
@media (min-width: 420px) { .kb-file-more { flex: 0 1 auto; } }
.kb-file-more > summary { list-style: none; }
.kb-file-more > summary::-webkit-details-marker { display: none; }
.kb-file-more[open] > summary { margin-bottom: 8px; }
.kb-file-rename { display: flex; gap: 6px; margin: 0 0 8px; }
.kb-file-rename .input { flex: 1; min-width: 0; }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); border-color: transparent; }
.kb-ed-files { border: .5px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 10px; margin: 0 0 8px; }
.kb-ed-files-head { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-ed-files-head .input { flex: 1 1 160px; min-width: 0; }
.kb-ed-files-head .btn { min-height: 44px; }
.kb-ed-files-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 50dvh; overflow-y: auto; }
.kb-ed-file { display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 44px; padding: 6px; border: .5px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-body); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.kb-ed-file:hover { border-color: var(--primary); }
.kb-ed-file:active { transform: scale(.97); }
.kb-ed-file img, .kb-ed-file .kb-file-ext { width: 100%; height: 72px; object-fit: cover; border-radius: calc(var(--radius) - 4px); }
.kb-ed-file-name { overflow-wrap: anywhere; line-height: 1.3; }

/* Editor preview (v21) */
.kb-ed-labelrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kb-ed-labelrow .btn { min-height: 44px; margin-bottom: 6px; }
.kb-ed-editing[hidden], .kb-ed-preview[hidden] { display: none; }
.kb-ed-preview { border: .5px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 12px 16px; margin: 0 0 8px; overflow-wrap: anywhere; }
.kb-ed-preview-note { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface); color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.kb-ed-preview .kb-body img, .kb-ed-preview .kb-body video { max-width: 100%; height: auto; }
.kb-ed-preview .kb-body table { display: block; max-width: 100%; overflow-x: auto; }
.kb-ed-preview .kb-term { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.kb-ed-leave { border: .5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 10px 14px; margin: 8px 0; color: var(--text-body); }
.kb-ed-leave[hidden] { display: none; }
.kb-ed-leave p { margin: 0 0 4px; font-weight: 500; }

/* drafts & review (v22) — editors' closed part only */
.kb-draft-bar { border: .5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 10px 14px; margin: 8px 0 12px; }
.kb-draft-bar .kb-actions { margin-top: 8px; }
.kb-draft-bar form { margin: 0; }
.kb-draft-state { margin: 0; color: var(--text-body); font-size: 14px; }
.kb-draft-note { margin: 6px 0 0; color: var(--text-body); font-size: 14px; overflow-wrap: anywhere; }
.kb-draft-discard { margin-top: 8px; }
.kb-draft-discard > summary { list-style: none; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; }
.kb-draft-discard > summary::-webkit-details-marker { display: none; }
.kb-draft-discard form { margin-top: 6px; }
.kb-draft-flag { color: var(--primary); font-weight: 550; }
.kb-draft-banner { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: .5px solid var(--border-strong); color: var(--text-secondary); font-size: 14px; overflow-wrap: anywhere; }
.kb-draft-banner b { color: var(--text-heading); }
.kb-draft-return { margin-top: 16px; max-width: 640px; }
.kb-draft-return textarea { width: 100%; resize: vertical; }

/* ---- Structure tab (v23): the menu tree with drag and drop */
.kb-st { margin-top: 4px; }
.kb-st.is-busy { opacity: .7; pointer-events: none; }
.kb-st-filter { flex: 1 1 200px; min-width: 0; }
.kb-st-list { list-style: none; margin: 0; padding: 0; }
.kb-st-list .kb-st-list { padding-left: 18px; border-left: .5px solid var(--border); margin-left: 14px; }
.kb-st-root { padding: 6px; border: .5px dashed transparent; border-radius: var(--radius); min-height: 44px; }
.kb-st-root.is-drop-root { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 6%, transparent); }
.kb-st-row {
  position: relative; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 2px 6px;
  margin: 2px 0; border: .5px solid var(--border); border-radius: var(--radius); background: var(--card);
  cursor: grab; transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}
.kb-st-row:hover { border-color: var(--border-strong); }
.kb-st-row.is-dragging { opacity: .45; }
.kb-st-row.is-inside { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 10%, var(--card)); }
.kb-st-row.is-before::before, .kb-st-row.is-after::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 3px; background: var(--primary);
}
.kb-st-row.is-before::before { top: -4px; }
.kb-st-row.is-after::after { bottom: -4px; }
.kb-st-row.is-moved { background: color-mix(in oklab, var(--primary) 14%, var(--card)); }
.kb-st-toggle {
  flex: 0 0 auto; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--text-secondary); font: inherit; font-size: 14px; cursor: pointer; border-radius: 8px;
}
.kb-st-toggle:hover { color: var(--primary); }
.kb-st-leaf { cursor: default; color: var(--text-tertiary); }
.kb-st-grip { flex: 0 0 auto; color: var(--text-tertiary); font-size: 12px; letter-spacing: -2px; user-select: none; }
.kb-st-title { flex: 1 1 auto; min-width: 0; font-size: 15px; color: var(--text-body); overflow-wrap: anywhere; }
.kb-st-count {
  flex: 0 0 auto; min-width: 24px; padding: 0 7px; border-radius: 999px; text-align: center;
  font-size: 12px; line-height: 20px; color: var(--text-secondary); background: var(--muted);
}
.kb-st-move {
  flex: 0 0 auto; min-height: 36px; padding: 0 10px; cursor: pointer; font: inherit; font-size: 13px;
  color: var(--text-secondary); background: none; border: .5px solid var(--border); border-radius: var(--radius);
  transition: transform 100ms ease;
}
.kb-st-move:hover { color: var(--primary); border-color: var(--border-strong); }
.kb-st-move:active { transform: scale(.97); }
.kb-st-h2 { margin-top: 20px; }
.kb-st-empty { padding: 10px; }
.kb-st-toast {
  position: fixed; left: 50%; bottom: calc(16px + var(--sab, 0px)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 24px);
  padding: 8px 8px 8px 14px; border-radius: var(--radius); background: var(--card); color: var(--text-body);
  border: .5px solid var(--border); box-shadow: 0 8px 28px rgb(0 0 0 / .18); font-size: 14px;
  animation: kb-st-in 180ms ease-out;
}
.kb-st-toast[hidden], .kb-st-dialog[hidden] { display: none; }
.kb-st-dialog {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center;
  background: rgb(0 0 0 / .4); animation: kb-st-fade 150ms ease-out;
}
.kb-st-dialog-box {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; margin: 0;
  border-radius: var(--radius) var(--radius) 0 0; padding-bottom: calc(16px + var(--sab, 0px));
  animation: kb-st-in 200ms ease-out;
}
@media (min-width: 640px) { .kb-st-dialog { align-items: center; } .kb-st-dialog-box { border-radius: var(--radius); } }
.kb-st-targets { list-style: none; margin: 8px 0 12px; padding: 0; max-height: 40vh; overflow: auto; border: .5px solid var(--border); border-radius: var(--radius); }
.kb-st-target {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px; text-align: left; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--text-body); background: none; border: 0; border-bottom: .5px solid var(--border);
}
.kb-st-target:hover { color: var(--primary); }
.kb-st-target.is-current { background: var(--primary); color: var(--primary-foreground); }
.kb-st-depth-1 { padding-left: 28px; } .kb-st-depth-2 { padding-left: 44px; } .kb-st-depth-3 { padding-left: 60px; }
.kb-st-depth-4 { padding-left: 76px; } .kb-st-depth-5 { padding-left: 92px; }
@keyframes kb-st-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.kb-st-dialog-box { animation-name: kb-st-up; }
@keyframes kb-st-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes kb-st-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 520px) { .kb-st-grip { display: none; } .kb-st-list .kb-st-list { padding-left: 8px; margin-left: 8px; } }

/* ---- Analytics (v24) — tiles, SVG bar chart, count lists; phone first, tokens only ---- */
.kb-an-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 14px; }
.kb-an-range label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.kb-an-range .input { min-height: 44px; font-size: 16px; }
.kb-an-range .btn { min-height: 44px; }
.kb-an-daynav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.kb-an-daynav .btn { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.kb-an-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
@media (min-width: 720px) { .kb-an-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kb-an-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-width: 0;
  background: var(--card); border: .5px solid var(--border); border-radius: var(--radius);
}
.kb-an-tile b { font-size: 22px; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.kb-an-tile span { font-size: 13px; color: var(--text-tertiary); }
.kb-an-chart svg { display: block; width: 100%; height: 140px; }
.kb-an-hit { fill: transparent; }
.kb-an-chart a:hover .kb-an-hit { fill: var(--muted); }
.kb-an-bar-v { fill: var(--primary); }
.kb-an-bar-s { fill: var(--text-tertiary); opacity: .55; }
.kb-an-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--text-tertiary); }
.kb-an-legend { margin: 8px 0 0; font-size: 13px; color: var(--text-secondary); }
.kb-an-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 8px; vertical-align: -1px; }
.kb-an-dot:first-child { margin-left: 0; }
.kb-an-dot-v { background: var(--primary); }
.kb-an-dot-s { background: var(--text-tertiary); opacity: .55; }
.kb-an-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
@media (min-width: 900px) { .kb-an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kb-an-grid .card { margin: 0; }
.kb-an-list { margin: 0; padding: 0; list-style: none; }
.kb-an-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 8px 0; border-top: .5px solid var(--border-subtle); font-size: 14px;
}
.kb-an-list li:first-child { border-top: 0; }
.kb-an-name { min-width: 0; overflow-wrap: anywhere; }
.kb-an-name a { color: var(--text-body); }
.kb-an-name a:hover { color: var(--primary); }
.kb-an-n { flex: 0 0 auto; color: var(--text-tertiary); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }

/* internal notes (v26) — editors' closed part only */
.kb-note-last { margin: 4px 0 8px; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.kb-note-task { color: var(--primary); }
.kb-note-flag { color: var(--text-secondary); font-weight: 550; }
.kb-notes { margin: 16px 0; }
.kb-note-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.kb-note { border: .5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 10px 14px; }
.kb-note-body { margin: 0; color: var(--text-body); font-size: 14px; overflow-wrap: anywhere; white-space: pre-line; }
.kb-note form { margin-top: 6px; }
.kb-note-add > summary { list-style: none; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; }
.kb-note-add > summary::-webkit-details-marker { display: none; }
.kb-note-add form { margin-top: 8px; display: grid; gap: 4px; }
.kb-ed-meta { display: grid; gap: 4px; margin: 12px 0 4px; }
.kb-ed-meta .input, .kb-note-add .input { font-size: 16px; width: 100%; }
.kb-hist-noteev .kb-hist-meta b { color: var(--text-body); font-weight: 550; }

/* ---- syntax cheat sheet (v27) ---- */
a.kb-ed-tool { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.kb-syn-nav a { color: var(--primary); }
.kb-syn-group { margin-top: 20px; }
.kb-syn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.kb-syn-item { background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); padding: 12px; }
.kb-syn-t { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--text-heading); }
.kb-syn-tool { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--text-tertiary); }
.kb-syn-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 768px) { .kb-syn-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.kb-syn-src { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.kb-syn-src pre { margin: 0; width: 100%; overflow-x: auto; padding: 10px; background: var(--muted); color: var(--text-body); border-radius: calc(var(--radius) - 2px); font-size: 13px; line-height: 1.5; white-space: pre; }
.kb-syn-copy { min-height: 36px; font-size: 13px; }
.kb-syn-out { min-width: 0; overflow-x: auto; padding: 10px; border: .5px dashed var(--border); border-radius: calc(var(--radius) - 2px); }
.kb-syn-out > :first-child { margin-top: 0; }
.kb-syn-out > :last-child { margin-bottom: 0; }
.kb-syn-auto { margin-top: 20px; }
.kb-syn-auto ul { margin: 8px 0; padding-left: 20px; color: var(--text-body); }
.kb-syn-ta { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }

/* THE EDITOR'S OWN WINDOW (v29): sticky top bar, sections column (wide) / «Разделы» button (phone),
   sticky formatting toolbar and a save bar pinned to the bottom of the screen. */
.kb-ed-top {
  position: sticky; top: 0; z-index: 20; margin: 0 -14px;
  background: var(--card); border-bottom: .5px solid var(--border);
}
.kb-ed-top-in { max-width: 1240px; margin: 0 auto; padding: 8px 14px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
.kb-ed-brand { flex: 1 1 auto; min-width: 0; color: var(--text-heading); font-weight: 650; font-size: 16px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-ed-brand:hover { color: var(--primary); }
.kb-ed-tosite { flex: 0 0 auto; min-height: 40px; }
.kb-ed-frame { max-width: 1240px; margin: 0 auto; }
.kb-ed-frame > main.kb-admin { max-width: none; margin: 0; min-width: 0; }
.kb-ed-side { display: none; }
.kb-ed-sections { margin: 12px 0 0; }
.kb-ed-sections > summary { list-style: none; width: 100%; min-height: 44px; justify-content: space-between; cursor: pointer; }
.kb-ed-sections > summary::-webkit-details-marker { display: none; }
.kb-ed-sections > summary::after { content: "▾"; color: var(--text-tertiary); }
.kb-ed-sections[open] > summary::after { content: "▴"; }
.kb-ed-sections-list { display: grid; gap: 2px; margin-top: 6px; padding: 6px; background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); }
.kb-ed-navlink {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius); color: var(--text-body); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color 100ms ease, background-color 100ms ease;
}
.kb-ed-navlink:hover { color: var(--primary); background: var(--surface); }
.kb-ed-navlink.is-current { background: var(--primary); color: var(--primary-foreground); }
.kb-ed-navcount { font-size: 12px; color: var(--text-tertiary); }
.kb-ed-navlink.is-current .kb-ed-navcount { color: var(--primary-foreground); opacity: .85; }
.kb-ed-navlink:focus-visible, .kb-ed-brand:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (min-width: 1024px) {
  .kb-ed-frame { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
  .kb-ed-sections { display: none; }
  .kb-ed-side {
    display: grid; gap: 2px; position: sticky; top: 72px; margin-top: 16px; padding: 6px;
    background: var(--card); border: .5px solid var(--border); border-radius: var(--radius);
  }
}
/* the article being edited: toolbar stays under the top bar, save buttons stay on screen */
.kb-ed-body .kb-ed-tools {
  position: sticky; top: 56px; z-index: 10; padding: 6px 0; margin-bottom: 8px;
  background: var(--background);
}
.kb-ed-savebar {
  position: sticky; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 8px;
  margin: 16px -14px 0; padding: 10px 14px calc(10px + var(--sab, 0px));
  background: var(--card); border-top: .5px solid var(--border);
}
.kb-ed-savebar .btn { min-height: 44px; flex: 1 1 auto; }
@media (min-width: 640px) { .kb-ed-savebar { margin: 16px 0 0; border: .5px solid var(--border); border-radius: var(--radius); } .kb-ed-savebar .btn { flex: 0 0 auto; } }
.kb-settings-open { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.kb-settings-open .btn { min-height: 44px; }

/* Change journal (v33) — /settings/edit/changelog */
.kb-cl-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kb-cl-q { flex: 1 1 220px; min-width: 0; }
.kb-cl-month { flex: 0 1 180px; min-width: 0; }
.kb-cl-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.kb-cl-item { background: var(--card); border: .5px solid var(--border); border-radius: var(--radius); padding: 14px; scroll-margin-top: 72px; }
.kb-cl-item:target { border-color: var(--primary); }
.kb-cl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.kb-cl-date { font-weight: 600; color: var(--text-heading); }
.kb-cl-kind { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: .5px solid var(--border); color: var(--text-secondary); }
.kb-cl-kind.kb-cl-released { color: var(--primary); border-color: var(--primary); }
.kb-cl-kind.kb-cl-rolled_back { color: var(--destructive); border-color: var(--destructive); }
.kb-cl-label { margin: 10px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-tertiary); }
.kb-cl-text { margin: 0; color: var(--text-body); line-height: 1.5; overflow-wrap: anywhere; }
.kb-cl-item .kb-hint a { color: var(--primary); }
.kb-cl-empty { margin-top: 16px; }

/* editor (v34): the home page's topics and questions */
.kb-home-form { display: grid; gap: 12px; }
.kb-home-topic { display: grid; gap: 10px; }
.kb-home-topic-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kb-home-title { flex: 1 1 220px; min-width: 0; font-weight: 600; }
.kb-home-pos { flex: 0 0 56px; width: 56px; text-align: center; }
.kb-home-qs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kb-home-q { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding-top: 10px; border-top: .5px solid var(--border); }
.kb-home-q-main { flex: 1 1 240px; min-width: 0; display: grid; gap: 6px; }
.kb-home-warn { margin: 0; font-size: 13px; }
.kb-home-del { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 13px; color: var(--text-secondary); }
.kb-home-report { list-style: none; margin: 0; padding: 0; }
.kb-home-report li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; border-top: .5px solid var(--border); overflow-wrap: anywhere; }
.kb-home-report em { font-style: normal; color: var(--text-tertiary); }

/* The article being edited (v35) — the site's menu tree in the editor's left column,
   the current article's row highlighted (admin.js → editTreeBlock). */
.kb-ed-tree { margin-top: 8px; padding-top: 8px; border-top: .5px solid var(--border); }
.kb-ed-tree-title { margin: 0 12px 4px; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-tertiary); }
.kb-ed-tree-here { margin: 0 0 6px; }
.kb-ed-tree-here > span { display: block; margin: 0 12px 2px; font-size: 12px; color: var(--text-secondary); }
.kb-ed-tree ul { list-style: none; margin: 0; padding: 0; }
.kb-ed-tree-sec > ul { padding-left: 14px; }
.kb-ed-tree-sec > summary { display: flex; align-items: center; gap: 2px; list-style: none; cursor: pointer; border-radius: var(--radius); }
.kb-ed-tree-sec > summary::-webkit-details-marker { display: none; }
.kb-ed-tree-sec > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.kb-ed-tree-chev { flex: 0 0 auto; width: 16px; height: 16px; margin-left: 4px; color: var(--text-tertiary); transition: transform 100ms ease; }
.kb-ed-tree-sec[open] > summary > .kb-ed-tree-chev { transform: rotate(90deg); }
.kb-ed-tree-link {
  display: block; flex: 1 1 auto; min-width: 0; min-height: 36px; padding: 8px 10px; border-left: 3px solid transparent;
  border-radius: var(--radius); color: var(--text-body); font-size: 13px; line-height: 1.35; text-decoration: none;
  overflow-wrap: anywhere; transition: color 100ms ease, background-color 100ms ease;
}
a.kb-ed-tree-link:hover { color: var(--primary); background: var(--surface); }
a.kb-ed-tree-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.kb-ed-tree-group { font-weight: 600; color: var(--text-heading); }
.kb-ed-tree-link.is-current, a.kb-ed-tree-link.is-current:hover {
  border-left-color: var(--primary); background: color-mix(in oklab, var(--primary) 16%, transparent);
  color: var(--text-heading); font-weight: 650;
}
.kb-ed-sections-list .kb-ed-tree { max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 1024px) {
  .kb-ed-side.has-tree { max-height: calc(100vh - 88px); overflow-y: auto; overscroll-behavior: contain; }
}

/* Update from EvaTeam (v38): the report groups on /settings */
.kb-eva-group > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 4px; color: var(--text-body); }
.kb-eva-group > summary::-webkit-details-marker { display: none; }
.kb-eva-group > summary::before { content: "›"; display: inline-block; width: 16px; color: var(--text-tertiary); transition: transform .15s; }
.kb-eva-group[open] > summary::before { transform: rotate(90deg); }
.kb-eva-list { margin: 8px 0 4px 16px; max-height: 320px; overflow-y: auto; font-size: 13px; overflow-wrap: anywhere; }

/* Assistant change page (v40) */
.kb-inline-form { display: inline-flex; margin: 0 8px 8px 0; }
.kb-pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--muted); padding: 8px; border-radius: var(--radius); }
