/* «База знаний» (public/knowledge-editor.js). Unlayered, follows the tidy rules: text 11–24 px,
   36 px controls (30 px compact), radius 10/8 px, one orange primary per screen. */
.kba { display: grid; gap: 16px; min-width: 0; }
.kba .manager-page-head h1 { margin: 2px 0 4px; }
.kba .manager-page-head p { margin: 0; max-width: 760px; color: #5f6972; font-size: 13px; line-height: 1.5; }
.kba-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kba i[data-lucide], .kba svg.lucide { width: 16px; height: 16px; flex: none; }
.kba-note { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #d6e9de; border-radius: 10px; background: #f0f8f3; color: #1d5b3c; font-size: 13px; }
.kba-note > span { flex: 1; }
.kba-note.is-error { border-color: #f1d0cc; background: #fdf1ef; color: #8c2a1f; }
.kba-note__close { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }

.kba-sections { display: flex; flex-wrap: wrap; gap: 6px; }
.kba-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 1px solid #dfe4e7; border-radius: 999px; background: #fff; color: #2c353b; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.kba-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--kba-accent, #9aa4ab); }
.kba-chip b { color: #77828a; font-weight: 650; }
.kba-chip.is-active { border-color: #20262a; background: #20262a; color: #fff; }
.kba-chip.is-active b { color: rgba(255, 255, 255, .7); }

.kba-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kba-toolbar select { width: auto; min-width: 170px; }
.kba-toolbar__count { margin-left: auto; color: #77828a; font-size: 12px; }
.kba-search { display: flex; flex: 1 1 280px; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border: 1px solid #d6dce0; border-radius: 8px; background: #fff; }
.kba-search:focus-within { border-color: #c9470a; box-shadow: 0 0 0 3px rgba(201, 71, 10, .18); }
.kba-search i, .kba-search svg { color: #77828a; }
.kba .kba-search input { flex: 1; min-width: 0; min-height: 34px; padding: 0; border: 0; background: transparent; box-shadow: none; outline: none; }

.kba-table-wrap { overflow-x: auto; border: 1px solid #dfe4e7; border-radius: 12px; background: #fff; }
.kba-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
.kba-table th { position: sticky; top: 0; padding: 9px 12px; border-bottom: 1px solid #e5e9ec; background: #f7f9fa; color: #5f6972; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.kba-table td { padding: 9px 12px; border-bottom: 1px solid #eef1f3; vertical-align: top; }
.kba-table tr:last-child td { border-bottom: 0; }
.kba-table tbody tr { cursor: pointer; }
.kba-table tbody tr:hover, .kba-table tbody tr:focus-visible { background: #fff7f2; outline: none; }
.kba-table td strong { display: block; font-size: 14px; line-height: 1.35; }
.kba-table td small { display: block; margin-top: 2px; color: #77828a; font-size: 11px; }
.kba-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.kba-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--kba-accent); vertical-align: 1px; }
.kba-flag { display: inline-flex; align-items: center; margin: 0 4px 2px 0; padding: 1px 7px; border-radius: 999px; background: #eef2f4; color: #46525a; font-size: 11px; font-style: normal; font-weight: 650; line-height: 1.6; white-space: nowrap; }
.kba-flag.is-live { background: #e9f6ef; color: #137a52; }
.kba-flag.is-hidden { background: #f1f2f3; color: #5f6972; }
.kba-flag.is-error { background: #fbeceb; color: #a93428; }
.kba-flag.is-warn { background: #fff4e0; color: #8a5a10; }
.kba-empty { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; border: 1px dashed #d6dce0; border-radius: 12px; background: #fff; color: #5f6972; font-size: 14px; text-align: center; }
.kba-spinner { width: 20px; height: 20px; border: 3px solid #f0e2da; border-top-color: #c9470a; border-radius: 50%; animation: kba-spin .8s linear infinite; }
@keyframes kba-spin { to { transform: rotate(360deg); } }

/* editor */
.kba-editor-head { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: -4px 0 0; padding: 10px 0; border-bottom: 1px solid #e3e7ea; background: var(--bg, #f2f4f5); }
.kba-editor-head__title { display: grid; flex: 1 1 260px; min-width: 0; }
.kba-editor-head__title strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.kba-editor-head__title small { color: #77828a; font-size: 12px; }
.kba-dirty { color: #c9470a; font-weight: 650; }
.kba-editor-head .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.kba-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.kba-layout.has-preview { grid-template-columns: minmax(0, 1fr) minmax(340px, 44%); }
.kba-form { display: grid; gap: 16px; min-width: 0; }
.kba-card { display: grid; gap: 12px; padding: 16px; border: 1px solid #dfe4e7; border-radius: 12px; background: #fff; min-width: 0; }
.kba-card > h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; font-size: 16px; }
.kba-card > h2 small { color: #77828a; font-size: 12px; font-weight: 500; }
.kba-row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kba-row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kba-field { display: grid; gap: 5px; min-width: 0; }
.kba-field > span:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: #46525a; font-size: 12px; font-weight: 650; }
.kba-field textarea { width: 100%; min-height: 64px; resize: vertical; }
.kba .kba-field textarea, .kba .kba-field input[type="text"], .kba .kba-grid input, .kba .kba-chips input { font-weight: 500; }
.kba .kba-field input[data-kb-path="h1"], .kba .kba-block--h2 input[data-kb-path$=".text"] { font-weight: 650; }
.kba-field input, .kba-field select { width: 100%; }
.kba-count { margin-left: auto; color: #77828a; font-size: 11px; font-weight: 500; }
.kba-count.is-over { color: #b9382a; font-weight: 650; }
.kba-hint { margin: 0; color: #77828a; font-size: 12px; font-weight: 400; line-height: 1.45; }
.kba-inline-tools { display: inline-flex; gap: 4px; margin-left: auto; }
.kba-mini { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 7px; border: 1px solid #dfe4e7; border-radius: 6px; background: #fff; color: #46525a; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.kba-mini:hover { border-color: #c9470a; color: #c9470a; }
.kba-mini i, .kba-mini svg { width: 13px !important; height: 13px !important; }
.kba-slug { display: flex; align-items: center; min-height: 36px; padding: 0 10px; border: 1px solid #d6dce0; border-radius: 8px; background: #f7f9fa; color: #5f6972; font-size: 13px; }
.kba-slug b { color: #20262a; }
.kba .kba-slug input { flex: 1; min-width: 80px; min-height: 30px; padding: 0 4px; border: 0; background: #fff; border-radius: 6px; }
.kba-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }

.kba-image { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 12px; align-items: start; }
.kba-image__thumb { display: grid; place-items: center; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid #e3e7ea; border-radius: 10px; background: #f4f6f7; color: #9aa4ab; font-size: 12px; }
.kba-image__thumb img { width: 100%; height: 100%; object-fit: cover; }
.kba-image__thumb span { display: grid; justify-items: center; gap: 4px; }
.kba-image__fields { display: grid; gap: 10px; min-width: 0; }
.kba-image__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kba-image__actions label.is-busy { opacity: .6; pointer-events: none; }
.kba-prompt textarea { min-height: 52px; font-size: 13px; }

.kba-blocks { gap: 10px; }
.kba-block { display: grid; gap: 10px; padding: 12px; border: 1px solid #e3e7ea; border-radius: 10px; background: #fbfcfc; }
.kba-block:focus-within { border-color: rgba(201, 71, 10, .45); background: #fff; }
.kba-block > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kba-block__type { display: inline-flex; align-items: center; gap: 6px; color: #46525a; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.kba-block__type i, .kba-block__type svg { color: #c9470a; }
.kba-block__tools, .kba-item__tools { display: inline-flex; gap: 2px; }
.kba-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #5f6972; cursor: pointer; }
.kba-icon:hover:not(:disabled) { border-color: #dfe4e7; background: #fff; color: #20262a; }
.kba-icon.is-danger:hover:not(:disabled) { color: #b9382a; }
.kba-icon:disabled { opacity: .35; cursor: default; }
.kba-icon i, .kba-icon svg { width: 15px !important; height: 15px !important; }
.kba-block--h2 { border-left: 3px solid #c9470a; }
.kba-items { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.kba-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 8px; border: 1px solid #e8ecee; border-radius: 8px; background: #fff; }
.kba-item__n { display: grid; place-items: center; width: 24px; height: 24px; margin-top: 18px; border-radius: 50%; background: #20262a; color: #fff; font-size: 11px; font-weight: 700; }
.kba-item__body { display: grid; gap: 8px; min-width: 0; }
.kba-item__tools { margin-top: 18px; }
.kba-grid-wrap { overflow-x: auto; }
.kba-grid { border-collapse: collapse; min-width: 100%; }
.kba-grid th, .kba-grid td { padding: 3px; vertical-align: middle; }
.kba-grid th { position: relative; }
.kba-grid th input { padding-right: 30px; font-weight: 650; background: #f2f4f5; }
.kba-grid th .kba-icon { position: absolute; top: 7px; right: 6px; width: 24px; height: 24px; }
.kba .kba-grid input { min-width: 140px; min-height: 32px; font-size: 13px; }
.kba-grid__tool { width: 1%; white-space: nowrap; }
.kba-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kba-chips input { flex: 1 1 180px; width: auto !important; }
.kba-chips .kba-hint { flex-basis: 100%; }
.kba-tag { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 4px 0 10px; border-radius: 999px; background: #fff1e9; color: #8e3510; font-size: 13px; font-weight: 650; }
.kba-tag button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.kba-tag button:hover { background: rgba(201, 71, 10, .15); }
.kba-tag i, .kba-tag svg { width: 13px !important; height: 13px !important; }
.kba-related { display: grid; gap: 4px; margin: 0; padding: 0 0 0 20px; font-size: 13px; }
.kba-related li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kba-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border: 1px dashed #d6dce0; border-radius: 10px; background: #fff; }
.kba-add > span { width: 100%; color: #77828a; font-size: 12px; font-weight: 650; }
.kba-add button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 1px solid #e3e7ea; border-radius: 8px; background: #fff; color: #2c353b; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.kba-add button:hover { border-color: #c9470a; color: #c9470a; }
.kba-add i, .kba-add svg { width: 14px !important; height: 14px !important; color: #c9470a; }

.kba-aside { position: sticky; top: 64px; display: grid; gap: 12px; max-height: calc(100vh - 80px); overflow-y: auto; min-width: 0; }
.kba-checks h2 { display: flex; align-items: center; gap: 6px; }
.kba-ok { display: flex; align-items: center; gap: 6px; margin: 0; color: #137a52; font-size: 13px; font-weight: 650; }
.kba-problems { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 12px; line-height: 1.45; }
.kba-problems li { display: grid; grid-template-columns: 16px 1fr; gap: 6px; }
.kba-problems li.is-error { color: #a93428; }
.kba-problems li.is-warn { color: #7a5210; }
.kba-problems i, .kba-problems svg { width: 14px !important; height: 14px !important; margin-top: 1px; }

/* dialogs */
.kba-dialog { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px 16px; background: rgba(18, 22, 25, .45); }
.kba-dialog__box { display: grid; gap: 12px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px; border-radius: 14px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.kba-dialog__box header, .kba-dialog__box footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kba-dialog__box h2 { margin: 0; font-size: 20px; }
.kba-templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.kba-templates button { display: grid; gap: 4px; padding: 14px; border: 1px solid #dfe4e7; border-radius: 10px; background: #fff; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.kba-templates button:hover, .kba-templates button:focus-visible { border-color: #c9470a; background: #fff7f2; }
.kba-templates strong { font-size: 14px; }
.kba-templates small { color: #5f6972; font-size: 12px; }
.kba-pick-group { display: grid; gap: 2px; }
.kba-pick-group > span { margin: 6px 0 2px; color: #77828a; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.kba-pick-group button, .kba-pick-check { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 36px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.kba-pick-group button:hover, .kba-pick-check:hover { background: #f4f6f7; }
.kba-pick-group small { color: #77828a; font-size: 11px; }

/* preview: an approximation of the storefront article */
.kba-preview-card { padding: 0; overflow: hidden; }
.kba-preview-card > h2 { padding: 14px 16px 0; }
.kba-preview { padding: 12px 18px 20px; color: #262e32; font: 15px/1.65 Inter, system-ui, sans-serif; overflow-wrap: anywhere; }
.kba-preview h1 { margin: 6px 0 8px; font-size: 24px; line-height: 1.15; }
.kba-preview h2 { margin: 22px 0 8px; font-size: 20px; line-height: 1.25; }
.kba-preview h3 { margin: 16px 0 6px; font-size: 16px; }
.kba-preview p, .kba-preview ul, .kba-preview ol { margin: 0 0 10px; }
.kba-preview a { color: #c9470a; }
.kba-preview img { display: block; width: 100%; height: auto; border-radius: 10px; background: #f4f2ee; }
.kbp-crumbs { color: #77828a; font-size: 11px; }
.kbp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; color: #6b7479; font-size: 12px; }
.kbp-meta span { padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--kba-accent) 12%, #fff); color: var(--kba-accent); font-weight: 700; }
.kbp-lead { color: #3f494e; font-size: 16px; }
.kbp-cover { margin: 12px 0 14px; }
.kba-preview figure { margin: 14px 0; }
.kba-preview figcaption { margin-top: 6px; color: #6b7479; font-size: 12px; text-align: center; }
.kbp-steps { margin: 14px 0; padding: 12px; border-radius: 12px; background: #f7f5f1; }
.kbp-steps h4 { margin: 0 0 8px; font-size: 15px; }
.kbp-steps ol { display: grid; gap: 8px; padding: 0; list-style: none; }
.kbp-steps li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 8px; border-radius: 10px; background: #fff; }
.kbp-steps li > b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e95a1b; color: #fff; font-size: 12px; }
.kbp-steps p { margin: 2px 0 0; font-size: 14px; }
.kbp-table { overflow-x: auto; margin: 12px 0; border: 1px solid #e6e2db; border-radius: 10px; }
.kbp-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kbp-table caption { padding: 8px 10px 4px; color: #5d666b; font-size: 12px; font-weight: 650; text-align: left; }
.kbp-table th { background: #1f2427; color: #fff; text-align: left; }
.kbp-table th, .kbp-table td { padding: 6px 10px; border-top: 1px solid #efece6; vertical-align: top; }
.kbp-tip { margin: 12px 0; padding: 10px 12px; border: 1px solid #d8e7f2; border-radius: 12px; background: #eef5fb; }
.kbp-tip.is-warning { border-color: #f3dfbd; background: #fff6e8; }
.kbp-tip.is-nit { border-color: #f6d6c6; background: #fff3ed; }
.kbp-tip p { margin: 0; font-size: 14px; }
.kbp-products { display: grid; gap: 6px; margin: 14px 0; padding: 12px; border: 1px solid #f0dacf; border-radius: 14px; background: #fff8f4; }
.kbp-products > small { color: #e95a1b; font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.kbp-products > div { display: grid; gap: 6px; }
.kbp-products span { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; background: #fff; font-size: 13px; }
.kbp-products span img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; }
.kbp-products em { color: #c9470a; font-style: normal; font-weight: 700; white-space: nowrap; }
.kbp-settings { margin: 12px 0; padding: 12px; border-radius: 12px; background: #1f2427; color: #fff; font-size: 13px; }
.kbp-settings > small { display: block; margin-top: 2px; color: rgba(255, 255, 255, .65); font-size: 12px; }
.kbp-settings dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin: 8px 0 0; }
.kbp-settings dl div { padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .08); }
.kbp-settings dt { color: rgba(255, 255, 255, .65); font-size: 11px; }
.kbp-settings dd { margin: 2px 0 0; font-weight: 700; }
.kbp-faq details { margin: 6px 0; padding: 8px 10px; border: 1px solid #e6e2db; border-radius: 10px; }
.kbp-faq summary { font-weight: 700; cursor: pointer; }
.kbp-faq details p { margin: 6px 0 0; font-size: 14px; }
.kbp-cta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; padding: 12px; border-radius: 12px; background: #1f2427; color: #fff; font-size: 13px; }
.kbp-cta.is-bot { background: #eef6fb; color: #13394d; }
.kbp-cta p { margin: 2px 0 0; opacity: .8; }
.kbp-cta > span { padding: 6px 10px; border-radius: 8px; background: #e95a1b; color: #fff; font-weight: 700; white-space: nowrap; }
.kbp-related ul { padding-left: 18px; }
.kbp-missing { margin: 10px 0; padding: 10px; border: 1px dashed #e0c2b3; border-radius: 10px; color: #8e3510; font-size: 12px; text-align: center; }
.kbp-serp { display: grid; gap: 2px; margin-top: 22px; padding: 12px; border: 1px solid #e3e7ea; border-radius: 10px; background: #fafbfb; font-size: 13px; }
.kbp-serp small { color: #77828a; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.kbp-serp b { color: #1a0dab; font-size: 15px; font-weight: 500; }
.kbp-serp span { color: #006621; font-size: 12px; }
.kbp-serp p { margin: 0; color: #4d5156; }

@media (max-width: 1180px) {
  .kba-layout, .kba-layout.has-preview { grid-template-columns: minmax(0, 1fr); }
  .kba-aside { position: static; max-height: none; }
}
@media (max-width: 720px) {
  .kba-image { grid-template-columns: minmax(0, 1fr); }
  .kba-editor-head .actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .kba-spinner { animation-duration: 2.4s; } }
