/* ============================================================
   БАЗА ЗНАНИЙ v480 (08.10.2026): плитки разделов, страница раздела с
   «← Все разделы», решение «Показать команде» на памятке и страница
   «Поделились с вами» в администрировании (классы sh-).
   ============================================================ */
:root {
  --kbc-blue: #1a6fb5; --kbc-blue-bg: #e8f2fc;
  --kbc-green: #0f7a5f; --kbc-green-bg: #e4f6ef;
  --kbc-violet: #6b46c1; --kbc-violet-bg: #f0eafc;
  --kbc-amber: #8a5a00; --kbc-amber-bg: #fdf3dd;
  --kbc-pink: #a3245c; --kbc-pink-bg: #fce8f0;
  --kbc-teal: #0e7490; --kbc-teal-bg: #e0f4f8;
  --kbc-red: #b02a3d; --kbc-red-bg: #fdeaed;
  --kbc-gray: #55647e; --kbc-gray-bg: #eef1f6;
}
[data-theme=dark] {
  --kbc-blue: #8cc2f2; --kbc-blue-bg: rgba(26, 111, 181, .2);
  --kbc-green: #7fd6b6; --kbc-green-bg: rgba(15, 122, 95, .22);
  --kbc-violet: #c7b4f6; --kbc-violet-bg: rgba(107, 70, 193, .22);
  --kbc-amber: #f3c66b; --kbc-amber-bg: rgba(240, 195, 109, .14);
  --kbc-pink: #f2a5c4; --kbc-pink-bg: rgba(163, 36, 92, .22);
  --kbc-teal: #7dd3e8; --kbc-teal-bg: rgba(14, 116, 144, .22);
  --kbc-red: #f19aa6; --kbc-red-bg: rgba(176, 42, 61, .22);
  --kbc-gray: #b7c5da; --kbc-gray-bg: rgba(140, 160, 190, .16);
}
.is-blue { --kbc: var(--kbc-blue); --kbc-bg: var(--kbc-blue-bg); }
.is-green { --kbc: var(--kbc-green); --kbc-bg: var(--kbc-green-bg); }
.is-violet { --kbc: var(--kbc-violet); --kbc-bg: var(--kbc-violet-bg); }
.is-amber { --kbc: var(--kbc-amber); --kbc-bg: var(--kbc-amber-bg); }
.is-pink { --kbc: var(--kbc-pink); --kbc-bg: var(--kbc-pink-bg); }
.is-teal { --kbc: var(--kbc-teal); --kbc-bg: var(--kbc-teal-bg); }
.is-red { --kbc: var(--kbc-red); --kbc-bg: var(--kbc-red-bg); }
.is-gray { --kbc: var(--kbc-gray); --kbc-bg: var(--kbc-gray-bg); }

/* ---- плитки разделов ---- */
.kb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.kb-tile {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 6px 14px; align-items: start;
  min-height: 132px; padding: 18px; text-align: left; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface-card); box-shadow: var(--shadow); transition: border-color .12s, transform .12s;
}
.kb-tile:hover { border-color: color-mix(in srgb, var(--kbc) 45%, var(--line)); transform: translateY(-1px); }
.kb-tile:focus-visible { outline: 2px solid var(--kbc); outline-offset: 2px; }
.kb-tile-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--kbc-bg); color: var(--kbc); }
.kb-tile-ico .kb-ico { width: 24px; height: 24px; }
.kb-tile-main { display: grid; gap: 4px; min-width: 0; }
.kb-tile-main b { color: var(--text); font-size: 15.5px; line-height: 1.3; }
.kb-tile-main small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.kb-tile em { grid-column: 2; align-self: end; color: var(--kbc); font-size: 12px; font-style: normal; font-weight: 800; }
.kb-tile.is-empty { box-shadow: none; border-style: dashed; background: transparent; }
.kb-tile.is-empty em { color: var(--text-soft); font-weight: 700; }
.kb-found { margin: -4px 0 12px; color: var(--muted); font-size: 12.5px; font-weight: 700; }

/* ---- страница раздела ---- */
.kb-section-head { display: grid; gap: 10px; margin-bottom: 16px; }
.kb-section-head .tk-back { justify-self: start; }
.kb-section-title { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.kb-section-title > div { flex: 1 1 260px; min-width: 0; }
.kb-section-title h2 { margin: 0; font-size: 21px; line-height: 1.25; }
.kb-section-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.kb-pill[class*="is-"] { display: inline-flex; align-items: center; gap: 5px; border-color: transparent; background: var(--kbc-bg); color: var(--kbc); }
.kb-pill .kb-ico { width: 13px; height: 13px; }

/* ---- плашки на первом экране ---- */
.kb-ask.is-share { border-style: solid; border-color: color-mix(in srgb, var(--tk-info, #1a6fb5) 40%, var(--line)); background: var(--tk-info-bg, #e8f2fc); color: var(--tk-info, #1a6fb5); }

/* ---- памятка: предпросмотр и решения ---- */
.kb-preview {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 10px 14px; border-radius: 12px;
  background: var(--kb-warn-bg); color: var(--kb-warn); font-size: 13px; font-weight: 700;
}
.kb-share { margin: 0 0 14px; }
.kb-share-box { margin-top: 14px; padding: 16px 20px; }
.kb-share-box header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.kb-share-box h2 { margin: 0; font-size: 15px; }

/* ---- разделы: окно администратора ---- */
dialog:has(.kb-sections) { width: min(620px, calc(100% - 24px)); }
.kb-sections ul { display: grid; gap: 6px; max-height: 56vh; margin: 0; padding: 0; overflow: auto; list-style: none; }
.kb-sections li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.kb-sections li .kb-tile-ico { width: 40px; height: 40px; border-radius: 11px; }
.kb-sections li .kb-tile-ico .kb-ico { width: 20px; height: 20px; }
.kb-sections li b { display: block; font-size: 13.5px; }
.kb-sections li small { display: block; overflow: hidden; color: var(--text-soft); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.kb-sections li button:disabled { opacity: .35; cursor: default; }
.kb-sec-form { display: grid; gap: 12px; }
.kb-sec-form fieldset { margin: 0; padding: 0; border: 0; }
.kb-sec-form legend { margin-bottom: 6px; font-size: 11px; font-weight: 700; }
.kb-sec-form input:not([type=radio]) { width: 100%; }
.kb-sec-icons, .kb-sec-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-sec-icons label, .kb-sec-colors label { position: relative; display: block; cursor: pointer; }
.kb-sec-icons input, .kb-sec-colors input { position: absolute; opacity: 0; pointer-events: none; }
.kb-sec-icons span { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.kb-sec-icons input:checked + span { border-color: var(--brand); background: var(--surface-selected); color: var(--tk-accent); }
.kb-sec-icons .kb-ico { width: 20px; height: 20px; }
.kb-sec-colors span { display: block; width: 30px; height: 30px; border: 2px solid transparent; border-radius: 50%; background: var(--kbc); }
.kb-sec-colors input:checked + span { box-shadow: 0 0 0 2px var(--surface-card), 0 0 0 4px var(--kbc); }
.kb-sec-form input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---- «Поделились с вами» ---- */
.sh-page { display: grid; gap: 12px; }
.sh-page > .tk-seg { justify-self: start; }
.sh-page > .hint { margin: 0; }
.sh-list { padding: 0; overflow: hidden; }
.sh-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.sh-row:first-child { border-top: 0; }
.sh-type { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.sh-type.is-note { background: var(--kbc-violet-bg); color: var(--kbc-violet); }
.sh-type.is-announcement { background: var(--kbc-blue-bg); color: var(--kbc-blue); }
.sh-main { display: grid; gap: 4px; min-width: 0; }
.sh-main b { font-size: 14px; line-height: 1.3; }
.sh-main small { color: var(--text-soft); font-size: 12px; }
.sh-centers { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.sh-c { display: inline-flex; align-items: center; gap: 5px; }
.sh-c em { font-size: 11.5px; font-style: normal; }

@media (max-width: 720px) {
  .kb-tiles { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .kb-tile { min-height: 0; padding: 14px; grid-template-columns: 44px minmax(0, 1fr); }
  .kb-tile-ico { width: 44px; height: 44px; }
  .kb-section-title h2 { font-size: 19px; }
  .kb-section-title .tk-seg { max-width: 100%; overflow-x: auto; }
  .sh-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .sh-row .sh-type { justify-self: start; }
  .sh-row > button { justify-self: start; }
  .kb-sections li { grid-template-columns: 36px minmax(0, 1fr) auto auto auto; }
}
