:root {
  --knowledge-catalog-text: #182235;
  --knowledge-catalog-muted: #718096;
  --knowledge-catalog-border: #dce6f0;
  --knowledge-catalog-accent: #3b82f6;
}

body.knowledge-category-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #eaf4fc 0%, #e8f2fb 48%, #e6f0f9 100%) !important;
}

.knowledge-category-wrapper {
  width: min(1350px, calc(100vw - 340px));
  min-height: 100vh;
  overflow-anchor: none;
  margin-left: max(300px, calc(260px + (100vw - 1610px) / 2));
  padding: 100px 32px 64px;
  color: var(--knowledge-catalog-text);
}

.knowledge-category-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(42px, 5vw, 84px); align-items: start; }
.knowledge-category-nav { position: sticky; top: 100px; min-width: 0; padding: 8px 0; }
.knowledge-category-nav__title { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 2px solid rgba(100, 116, 139, .22); font-size: 1rem; font-weight: 750; }
.knowledge-category-nav__list { display: grid; gap: 5px; }
.knowledge-category-nav__item { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 9px 12px; border-radius: 10px; color: #52617a; font-size: .88rem; font-weight: 600; text-decoration: none !important; transition: color .2s ease, background .2s ease; }
.knowledge-category-nav__item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-category-label__emoji { display: inline-block; margin-right: .42em; }
.knowledge-category-nav__item small { display: inline-grid; flex: 0 0 auto; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(148, 163, 184, .12); color: #718096; font-size: .7rem; font-weight: 700; }
.knowledge-category-nav__item:hover { background: rgba(255, 255, 255, .48); color: var(--knowledge-catalog-accent); }
.knowledge-category-nav__item.is-active { background: rgba(219, 234, 254, .88); color: #2563eb; }
.knowledge-category-nav__item.is-active small { background: rgba(59, 130, 246, .14); color: #2563eb; }
.knowledge-category-mobile-tree { display: none; }

.knowledge-category-content { min-width: 0; }
.knowledge-category-content__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 4px 4px 20px; border-bottom: 1px solid var(--knowledge-catalog-border); }
.knowledge-category-content__header h1 { margin: 0; font-size: clamp(1.55rem, 2.2vw, 2rem); line-height: 1.3; letter-spacing: -.03em; }
.knowledge-category-content__header p { margin: 8px 0 0; color: var(--knowledge-catalog-muted); font-size: .9rem; line-height: 1.65; }
.knowledge-category-content__header > div > span { display: block; margin-top: 6px; color: #8490a3; font-size: .78rem; }
.knowledge-category-menu { display: none; align-items: center; gap: 6px; flex: 0 0 auto; min-height: 36px; padding: 0 12px; border: 1px solid rgba(148, 163, 184, .24); border-radius: 10px; background: rgba(255, 255, 255, .72); color: #475569; font-size: .8rem; font-weight: 700; }

.knowledge-category-entries { display: grid; margin-top: 14px; overflow: hidden; border: 1px solid rgba(148, 163, 184, .16); border-radius: 16px; background: rgba(255, 255, 255, .7); }
.knowledge-category-entry { display: flex; align-items: center; gap: 16px; min-width: 0; min-height: 66px; padding: 13px 20px; border-bottom: 1px solid var(--knowledge-catalog-border); color: inherit; text-decoration: none !important; transition: background .2s ease; }
.knowledge-category-entry:last-child { border-bottom: 0; }
.knowledge-category-entry:hover { background: rgba(255, 255, 255, .82); }
.knowledge-category-entry__icon { color: #94a3b8; font-size: .88rem; }
.knowledge-category-entry__body { display: grid; min-width: 0; flex: 1; gap: 3px; }
.knowledge-category-entry__title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; min-width: 0; }
.knowledge-category-entry__title-row strong { min-width: 0; overflow: hidden; color: #25324a; font-size: .92rem; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-category-entry__title-row time { flex: 0 0 auto; color: #8490a3; font-size: .74rem; }
.knowledge-category-entry__arrow { flex: 0 0 auto; color: #b4c0ce; font-size: .7rem; transition: color .2s ease, transform .2s ease; }
.knowledge-category-entry:hover .knowledge-category-entry__arrow { color: var(--knowledge-catalog-accent); transform: translateX(2px); }
.knowledge-category-empty { padding: 50px 20px; color: var(--knowledge-catalog-muted); text-align: center; }

.knowledge-category-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 28px; color: #718096; font-size: .82rem; }
.knowledge-category-pagination a { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(148, 163, 184, .24); border-radius: 10px; background: rgba(255, 255, 255, .74); color: #475569; text-decoration: none; transition: color .2s ease, border-color .2s ease; }
.knowledge-category-pagination a:hover { border-color: rgba(59, 130, 246, .34); color: var(--knowledge-catalog-accent); }
.knowledge-category-backdrop { display: none; }

body.dark.knowledge-category-page { background: #0b1120 !important; }
body.dark .knowledge-category-nav__title { border-color: rgba(148, 163, 184, .25); color: #edf2fa; }
body.dark .knowledge-category-nav__item { color: #aab7ca; }
body.dark .knowledge-category-nav__item:hover { background: rgba(30, 41, 59, .72); color: #bfdbfe; }
body.dark .knowledge-category-nav__item.is-active { background: rgba(37, 99, 235, .22); color: #bfdbfe; }
body.dark .knowledge-category-nav__item.is-active small { background: rgba(147, 197, 253, .17); color: #bfdbfe; }
body.dark .knowledge-category-content__header { border-color: rgba(148, 163, 184, .22); }
body.dark .knowledge-category-content__header h1 { color: #edf2fa; }
body.dark .knowledge-category-content__header p, body.dark .knowledge-category-content__header > div > span { color: #9aa8bd; }
body.dark .knowledge-category-entries { border-color: rgba(148, 163, 184, .16); background: rgba(30, 41, 59, .68); }
body.dark .knowledge-category-entry { border-color: rgba(148, 163, 184, .16); }
body.dark .knowledge-category-entry:hover { background: rgba(51, 65, 85, .56); }
body.dark .knowledge-category-entry__title-row strong { color: #e2e8f0; }
body.dark .knowledge-category-entry__title-row time, body.dark .knowledge-category-empty { color: #9aa8bd; }
body.dark .knowledge-category-menu, body.dark .knowledge-category-pagination a { border-color: rgba(148, 163, 184, .24); background: rgba(30, 41, 59, .8); color: #cbd5e1; }

@media (max-width: 1000px) {
  .knowledge-category-wrapper { width: 100%; margin: 0; padding: 42px clamp(18px, 5vw, 40px) 52px; }
  .knowledge-category-layout { display: block; }
  .knowledge-category-nav { position: static; width: 100%; margin: 0 0 18px; padding: 0; overflow: visible; visibility: visible; background: transparent; box-shadow: none; transform: none; pointer-events: auto; }
  .knowledge-category-nav__title,
  .knowledge-category-nav__list { display: none; }
  .knowledge-category-mobile-tree { display: grid; gap: 6px; }
  .knowledge-category-mobile-tree__hero { margin-bottom: 13px; padding: 4px 2px 16px; border-bottom: 2px solid rgba(100, 116, 139, .22); }
  .knowledge-category-mobile-tree__hero > span { color: #8aa1bd; font-size: .72rem; font-weight: 700; letter-spacing: .08em; }
  .knowledge-category-mobile-tree__hero h1 { margin: 4px 0 3px; color: #1e2a3e; font-size: 1.45rem; line-height: 1.3; }
  .knowledge-category-mobile-tree__hero p { margin: 0 0 5px; overflow: hidden; color: #718096; font-size: .78rem; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
  .knowledge-category-mobile-tree__hero p:empty { display: none; }
  .knowledge-category-mobile-tree__hero small { color: #8aa1bd; font-size: .7rem; }
  .knowledge-category-mobile-tree details { min-width: 0; }
  .knowledge-category-mobile-tree summary { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 6px; min-height: 42px; padding: 9px 11px; border: 1px solid rgba(148, 163, 184, .16); border-radius: 11px; background: rgba(255, 255, 255, .44); color: #52617a; cursor: pointer; font-size: .94rem; font-weight: 700; list-style: none; box-shadow: 0 2px 8px rgba(30, 64, 110, .025); transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
  .knowledge-category-mobile-tree summary::-webkit-details-marker { display: none; }
  .knowledge-category-mobile-tree summary::before { width: 16px; color: #8aa1bd; content: '›'; font-size: 1.2rem; line-height: 1; transform: translateY(-1px); transition: transform .18s ease, color .18s ease; }
  .knowledge-category-mobile-tree summary:hover { border-color: rgba(96, 165, 250, .34); background: rgba(255, 255, 255, .72); }
  .knowledge-category-mobile-tree details[open] > summary { border-color: rgba(96, 165, 250, .3); background: rgba(219, 234, 254, .48); color: #2563eb; box-shadow: 0 4px 12px rgba(59, 130, 246, .06); }
  .knowledge-category-mobile-tree details[open] > summary::before { color: #2563eb; transform: rotate(90deg) translateX(-1px); }
  .knowledge-category-mobile-tree summary > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .knowledge-category-mobile-tree summary small { min-width: 21px; padding: 2px 6px; border-radius: 999px; background: rgba(59, 130, 246, .1); color: #2563eb; font-size: .68rem; text-align: center; }
  .knowledge-category-mobile-tree__children { display: grid; gap: 1px; margin: 1px 0 5px 17px; padding: 3px 0 3px 13px; border-left: 1px solid rgba(148, 163, 184, .28); }
  .knowledge-category-mobile-tree__children a { display: block; min-width: 0; overflow: hidden; padding: 8px 10px; border-radius: 7px; color: #64748b; font-size: .92rem; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; transition: background .18s ease, color .18s ease; }
  .knowledge-category-mobile-tree__children a:hover { background: rgba(255, 255, 255, .62); color: #2563eb; }
  .knowledge-category-content__header,
  .knowledge-category-entries,
  .knowledge-category-pagination { display: none; }
  .knowledge-category-backdrop,
  .knowledge-category-menu { display: none; }
  body.dark .knowledge-category-mobile-tree__hero { border-color: rgba(148, 163, 184, .25); }
  body.dark .knowledge-category-mobile-tree__hero h1 { color: #edf2fa; }
  body.dark .knowledge-category-mobile-tree__hero p,
  body.dark .knowledge-category-mobile-tree__hero small { color: #9aa8bd; }
  body.dark .knowledge-category-mobile-tree summary { border-color: rgba(148, 163, 184, .18); background: rgba(30, 41, 59, .5); color: #cbd5e1; }
  body.dark .knowledge-category-mobile-tree summary:hover { background: rgba(30, 41, 59, .78); }
  body.dark .knowledge-category-mobile-tree details[open] > summary { border-color: rgba(96, 165, 250, .32); background: rgba(37, 99, 235, .18); color: #bfdbfe; }
  body.dark .knowledge-category-mobile-tree__children a { color: #aab7ca; }
  body.dark .knowledge-category-mobile-tree__children a:hover { background: rgba(30, 41, 59, .62); color: #bfdbfe; }
}

@media (max-width: 620px) {
  .knowledge-category-wrapper { padding-top: 28px; }
  .knowledge-category-content__header { padding: 0 0 16px; }
  .knowledge-category-content__header h1 { font-size: 1.4rem; }
  .knowledge-category-content__header p { font-size: .82rem; }
  .knowledge-category-entries { margin-top: 12px; border-radius: 14px; }
  .knowledge-category-entry { gap: 11px; min-height: 60px; padding: 11px 14px; }
  .knowledge-category-entry__title-row { gap: 10px; }
  .knowledge-category-entry__title-row strong { font-size: .86rem; }
  .knowledge-category-entry__title-row time { font-size: .68rem; }
}
