/* Nikaya Tâm Học 2026 — Article detail v467
   Detail-only rules. Keeps the shared index/theme layout intact and prevents legacy TOC overflow. */
html.nk-detail-lite,
body.nk-detail-lite-runtime {
  overflow-x: hidden;
}
body.nk-detail-lite-runtime .noidungchinh,
body.nk-detail-lite-runtime .nk-article-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
body.nk-detail-lite-runtime .noidungchinh img,
body.nk-detail-lite-runtime .noidungchinh iframe,
body.nk-detail-lite-runtime .noidungchinh video,
body.nk-detail-lite-runtime .noidungchinh table {
  max-width: 100%;
}
body.nk-detail-lite-runtime .noidungchinh iframe {
  width: 100%;
}

/* v467 — One compact floating article TOC on the right. */
.nk-article-toc {
  position: fixed;
  z-index: 1042;
  top: 118px;
  right: 24px;
  width: 292px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 148px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border: 1px solid rgba(32, 77, 61, .14);
  border-radius: 12px;
  background: rgba(255, 253, 249, .98);
  color: #263a32;
  box-shadow: 0 10px 30px rgba(21, 54, 43, .14);
  overflow: hidden;
  backdrop-filter: blur(7px);
  transition: opacity .18s ease, transform .18s ease;
}
.nk-article-toc.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(18px);
}
.nk-article-toc__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 8px 9px 8px 12px;
  border-bottom: 1px solid rgba(32, 77, 61, .10);
  background: #fffdf9;
}
.nk-article-toc__title {
  margin: 0;
  color: #153f31;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .02em;
}
.nk-article-toc__actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.nk-article-toc__icon {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #e2ded6;
  border-radius: 7px;
  background: #fff;
  color: #42554d;
  font: 600 17px/1 Arial, sans-serif;
  cursor: pointer;
}
.nk-article-toc__icon:hover,
.nk-article-toc__icon:focus-visible {
  border-color: #98b2a7;
  background: #f4f8f6;
  color: #0c5d43;
  outline: none;
}
.nk-article-toc__body {
  min-height: 0;
  overflow: auto;
  padding: 7px 8px 9px;
  scrollbar-width: thin;
  scrollbar-color: #a9b5af transparent;
  overscroll-behavior: contain;
}
.nk-article-toc.is-collapsed {
  width: 188px;
}
.nk-article-toc.is-collapsed .nk-article-toc__body {
  display: none;
}
.nk-article-toc.is-collapsed .nk-article-toc__head {
  border-bottom: 0;
}
.nk-article-toc__list,
.nk-article-toc__sublist {
  margin: 0;
  padding: 0;
  list-style: none;
}
.nk-article-toc__sublist {
  margin: 1px 0 5px 9px;
  padding-left: 8px;
  border-left: 1px solid #e1e9e5;
}
.nk-article-toc__item {
  margin: 0;
}
.nk-article-toc__link {
  display: block;
  margin: 0;
  padding: 5px 7px;
  border-left: 3px solid transparent;
  border-radius: 6px;
  color: #34473f;
  font-size: 12.25px;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}
.nk-article-toc__item--h2 > .nk-article-toc__link {
  margin-top: 3px;
  color: #233b32;
  font-weight: 700;
}
.nk-article-toc__sublist .nk-article-toc__link {
  padding-top: 4px;
  padding-bottom: 4px;
  color: #506159;
  font-size: 11.75px;
  font-weight: 500;
}
.nk-article-toc__link:hover,
.nk-article-toc__link:focus-visible {
  background: #f1f6f3;
  color: #0d6045;
  text-decoration: none;
  outline: none;
}
.nk-article-toc__link.is-active {
  border-left-color: #1d8a64;
  background: #edf5f1;
  color: #0d573f;
  font-weight: 700;
}
.nk-article-toc-launcher {
  position: fixed;
  z-index: 1041;
  top: 128px;
  right: 18px;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid rgba(32, 77, 61, .16);
  border-radius: 999px;
  background: #fffdf9;
  color: #174c3a;
  box-shadow: 0 6px 20px rgba(21, 54, 43, .13);
  font: 700 12px/1.2 inherit;
  cursor: pointer;
}
.nk-article-toc-launcher.is-visible {
  display: inline-flex;
}
.nk-article-toc-launcher:hover,
.nk-article-toc-launcher:focus-visible {
  background: #f0f7f3;
  outline: 2px solid rgba(29, 138, 100, .18);
  outline-offset: 2px;
}
.noidungchinh h2[id],
.noidungchinh h3[id] {
  scroll-margin-top: 88px;
}

@media (min-width: 1500px) {
  .nk-article-toc { right: 32px; width: 306px; }
}
@media (max-width: 1199.98px) {
  .nk-article-toc {
    top: 105px;
    right: 14px;
    width: 276px;
    max-height: calc(100vh - 125px);
  }
  .nk-article-toc-launcher { top: 111px; right: 12px; }
}
@media (max-width: 767.98px) {
  .nk-article-toc {
    top: 76px;
    right: 10px;
    width: min(310px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 92px);
    border-radius: 10px;
  }
  .nk-article-toc__link { font-size: 12px; }
  .nk-article-toc__sublist .nk-article-toc__link { font-size: 11.5px; }
  .nk-article-toc-launcher {
    top: auto;
    right: 12px;
    bottom: 76px;
    padding: 9px 12px;
  }
}

/* Legacy ScrollNav must never affect article layout if cached markup survives. */
body.nk-detail-lite-runtime .scroll-nav,
body.nk-detail-lite-runtime nav.scroll-nav {
  display: none !important;
  width: auto !important;
  height: auto !important;
  float: none !important;
}


/* ==========================================================
   v470 — ViewBV uses the SAME header/sidebar/right tools shell as index.
   No duplicate detail header. The article TOC remains the only detail-only float.
   ========================================================== */
body.nk-detail-lite-runtime > .app-container > .app-header,
body.nk-detail-lite-runtime .app-container > .app-header {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: var(--nk17-header-h, 72px) !important;
  min-height: var(--nk17-header-h, 72px) !important;
  overflow: visible !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
body.nk-detail-lite-runtime .app-main {
  padding-top: var(--nk17-header-h, 72px) !important;
}
body.nk-detail-lite-runtime .app-sidebar {
  top: var(--nk17-header-h, 72px) !important;
}
body.nk-detail-lite-runtime .nk-article-toc {
  top: calc(var(--nk17-header-h, 72px) + 46px);
  max-height: calc(100vh - var(--nk17-header-h, 72px) - 66px);
}
body.nk-detail-lite-runtime .nk-article-toc-launcher {
  top: calc(var(--nk17-header-h, 72px) + 52px);
}
body.nk-detail-lite-runtime .noidungchinh h2[id],
body.nk-detail-lite-runtime .noidungchinh h3[id] {
  scroll-margin-top: calc(var(--nk17-header-h, 72px) + 18px);
}
/* Right/system drawers must stay available exactly as on index. */
body.nk-detail-lite-runtime .ui-theme-settings,
body.nk-detail-lite-runtime .app-drawer-wrapper,
body.nk-detail-lite-runtime .app-drawer-overlay {
  visibility: visible;
}
@media (max-width: 860px) {
  body.nk-detail-lite-runtime .app-main { padding-top: 58px !important; }
  body.nk-detail-lite-runtime .app-sidebar { top: 58px !important; }
  body.nk-detail-lite-runtime .nk-article-toc {
    top: 72px;
    max-height: calc(100vh - 88px);
  }
  body.nk-detail-lite-runtime .nk-article-toc-launcher { top: auto; }
}
