/* TOC Monkey public enhancement layer — intentionally separate from monolithic index.html */
html { scroll-behavior: smooth; }

/* ── OSINT / RSS FEED VIEWPORTS ─────────────────────────────────────────── */
.tm-feed-window {
  height: clamp(270px, 34vh, 390px) !important;
  min-height: 270px !important;
  max-height: 390px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  -webkit-overflow-scrolling: touch;
}
.tm-feed-window > * { scroll-snap-align: start; }
.tm-feed-window.tm-feed-compact > * {
  min-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ── LAUNCHER ───────────────────────────────────────────────────────────── */
#tm-knowledge-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99990;
  border: 1px solid #7f8a96;
  background: #0c0f12;
  color: #f4f6f8;
  font: 700 12px/1.1 'Courier New', monospace;
  letter-spacing: .75px;
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.38);
}
#tm-knowledge-launcher:hover,
#tm-knowledge-launcher:focus-visible { background: #171c21; outline: 1px solid #b9c2ca; }

/* ── AO KNOWLEDGE DRAWER ───────────────────────────────────────────────── */
#tm-knowledge-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 99991;
  width: min(760px, 97vw);
  background: #090c0f;
  color: #dfe4e9;
  border-left: 1px solid #626d78;
  box-shadow: -18px 0 48px rgba(0,0,0,.62);
  transform: translateX(101%);
  transition: transform 190ms ease;
  font-family: 'Courier New', monospace;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#tm-knowledge-drawer.tm-open { transform: translateX(0); }

.tm-k-head {
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid #39424b;
  display: flex;
  gap: 12px;
  align-items: center;
  background: #0d1115;
}
.tm-k-head > div:first-child { flex: 1; min-width: 0; }
.tm-k-title { font-weight: 700; color: #fff; letter-spacing: 1px; font-size: 14px; }
.tm-k-subtitle { color: #7f8d9a; font-size: 9px; letter-spacing: .8px; margin-top: 3px; }
.tm-k-close,
.tm-k-open,
.tm-k-back,
.tm-k-related,
.tm-k-search-tag {
  font-family: inherit;
}
.tm-k-close {
  background: transparent;
  color: #dfe4e9;
  border: 1px solid #626d78;
  padding: 6px 9px;
  cursor: pointer;
}
.tm-k-close:hover { background: #1b2229; }

.tm-k-tools {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-bottom: 1px solid #343c44;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #0b0f12;
}
.tm-k-tools select,
.tm-k-tools input {
  width: 100%;
  min-width: 0;
  background: #11161b;
  color: #eef1f4;
  border: 1px solid #46515c;
  padding: 8px;
  font: 11px/1.25 'Courier New', monospace;
}
.tm-k-tools select:focus,
.tm-k-tools input:focus { outline: 1px solid #96a4b1; border-color: #96a4b1; }

.tm-k-focus {
  flex: 0 0 auto;
  padding: 9px 14px;
  color: #a8b4c0;
  font-size: 11px;
  line-height: 1.4;
  border-bottom: 1px solid #242b31;
  background: #0e1317;
}
.tm-k-stats {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 14px;
  border-bottom: 1px solid #242b31;
  background: #090d10;
}
.tm-k-stats span {
  border: 1px solid #35404a;
  color: #9eabb7;
  padding: 3px 5px;
  font-size: 9px;
  letter-spacing: .35px;
}
.tm-k-reference {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-bottom: 1px solid #242b31;
  background: #0b1014;
}
.tm-k-ref-label { color: #758493; font-size: 9px; letter-spacing: .75px; margin-bottom: 5px; }
.tm-k-ref-links { display: flex; gap: 6px 12px; flex-wrap: wrap; }
.tm-k-ref-links a,
.tm-k-dossier-sources a,
.tm-k-system a,
.tm-k-signal a {
  color: #8ec8ff;
  text-decoration: none;
}
.tm-k-ref-links a { font-size: 10px; }
.tm-k-ref-links a:hover,
.tm-k-dossier-sources a:hover,
.tm-k-system a:hover,
.tm-k-signal a:hover { text-decoration: underline; }

.tm-k-list,
.tm-k-detail {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  padding: 12px 14px 30px;
  scroll-behavior: smooth;
}
.tm-k-loading,
.tm-k-empty,
.tm-k-muted { color: #81909d; font-size: 11px; line-height: 1.45; }
.tm-k-loading,
.tm-k-empty { border: 1px dashed #39444e; padding: 16px; text-align: center; }

/* ── ACTOR CARDS ────────────────────────────────────────────────────────── */
.tm-k-card {
  border: 1px solid #343d45;
  background: #101418;
  padding: 12px;
  margin-bottom: 9px;
  border-radius: 3px;
}
.tm-k-card:hover { border-color: #596773; background: #12181d; }
.tm-k-card-top { display: flex; gap: 10px; align-items: flex-start; }
.tm-k-card-top > div { flex: 1; min-width: 0; }
.tm-k-card h3 { color: #fff; font-size: 13px; line-height: 1.25; margin: 0 0 4px; }
.tm-k-meta { color: #92a0ad; font-size: 9px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .45px; }
.tm-k-summary { color: #d3d9df; font-size: 11px; line-height: 1.48; margin-bottom: 8px; }
.tm-k-open {
  flex: 0 0 auto;
  background: #161d23;
  color: #dce3e9;
  border: 1px solid #53606b;
  cursor: pointer;
  padding: 6px 7px;
  font-size: 9px;
  letter-spacing: .35px;
}
.tm-k-open:hover { border-color: #9aa8b5; background: #202932; }
.tm-k-tags { display: flex; gap: 5px; flex-wrap: wrap; margin: 7px 0; }
.tm-k-tag {
  border: 1px solid #46515c;
  background: transparent;
  padding: 3px 5px;
  color: #cbd3da;
  font-size: 9px;
  line-height: 1.2;
  border-radius: 2px;
}
button.tm-k-tag { cursor: pointer; }
button.tm-k-tag:hover { background: #1d252c; border-color: #7c8995; }
.tm-k-card-systems {
  border-top: 1px solid #252d34;
  padding-top: 7px;
  color: #98a5b1;
  font-size: 9px;
  line-height: 1.4;
}
.tm-k-card-systems b { color: #c4cdd5; }
.tm-k-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  color: #6f7c87;
  font-size: 8px;
  letter-spacing: .35px;
}
.tm-k-card-foot .tm-live { color: #8ee2a3; }

/* ── DOSSIER VIEW ───────────────────────────────────────────────────────── */
.tm-k-breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.tm-k-breadcrumb span { color: #7f8c98; font-size: 9px; margin-left: auto; }
.tm-k-back {
  background: transparent;
  border: 0;
  color: #9dcbf5;
  padding: 0;
  cursor: pointer;
  font-size: 10px;
}
.tm-k-back:hover { text-decoration: underline; }
.tm-k-dossier {
  border: 1px solid #39444d;
  background: #0f1418;
  padding: 15px;
}
.tm-k-dossier h2 { color: #fff; font-size: 18px; line-height: 1.2; margin: 0 0 5px; }
.tm-k-dossier-meta { color: #8d9aa6; font-size: 9px; letter-spacing: .55px; margin-bottom: 12px; text-transform: uppercase; }
.tm-k-dossier-summary { color: #d9dfe4; font-size: 12px; line-height: 1.55; margin: 0 0 14px; }
.tm-k-dossier section { border-top: 1px solid #2b343c; padding-top: 11px; margin-top: 11px; }
.tm-k-dossier h4 { color: #9eabb6; font-size: 9px; letter-spacing: .9px; margin: 0 0 8px; }

.tm-k-systems { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.tm-k-system {
  border: 1px solid #303b44;
  background: #0b1014;
  padding: 9px;
  min-width: 0;
}
.tm-k-system > div { display: flex; flex-direction: column; gap: 3px; }
.tm-k-system b { color: #eef2f5; font-size: 10px; line-height: 1.3; }
.tm-k-system span { color: #7e8c98; font-size: 8px; text-transform: uppercase; }
.tm-k-system p { color: #aeb8c1; font-size: 9px; line-height: 1.4; margin: 6px 0; }
.tm-k-system a { display: inline-block; margin-top: 7px; font-size: 8px; }

.tm-k-related-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.tm-k-related {
  text-align: left;
  background: #0b1014;
  border: 1px solid #34404a;
  color: #dce2e7;
  padding: 8px;
  cursor: pointer;
  min-width: 0;
}
.tm-k-related:hover:not(.tm-k-related-static) { border-color: #80909e; background: #141c22; }
.tm-k-related span { display: block; color: #75838f; font-size: 8px; text-transform: uppercase; margin-bottom: 4px; }
.tm-k-related b { display: block; font-size: 10px; line-height: 1.3; }
.tm-k-related-static { cursor: default; }

.tm-k-signals { display: grid; gap: 7px; }
.tm-k-signal { border-left: 2px solid #4d6b57; background: #0a0f0c; padding: 8px 9px; }
.tm-k-signal a { font-size: 10px; line-height: 1.35; font-weight: 700; }
.tm-k-signal p { color: #aeb8b1; font-size: 9px; line-height: 1.45; margin: 5px 0; }
.tm-k-signal > div { color: #69766e; font-size: 8px; }
.tm-k-dossier-sources { display: flex; gap: 7px 14px; flex-wrap: wrap; }
.tm-k-dossier-sources a { font-size: 9px; }

.tm-k-note {
  flex: 0 0 auto;
  color: #6f7c87;
  font-size: 8px;
  line-height: 1.45;
  padding: 8px 14px 11px;
  border-top: 1px solid #242b31;
  background: #080b0e;
}

@media (max-width: 760px) {
  #tm-knowledge-launcher { right: 10px; bottom: 10px; }
  #tm-knowledge-drawer { width: 100vw; }
  .tm-k-tools { grid-template-columns: 1fr; }
  .tm-k-systems,
  .tm-k-related-grid { grid-template-columns: 1fr; }
  .tm-feed-window { height: 310px !important; min-height: 250px !important; max-height: 340px !important; }
  .tm-k-card-top { flex-direction: column; }
  .tm-k-open { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html, .tm-feed-window, .tm-k-list, .tm-k-detail { scroll-behavior: auto; }
  #tm-knowledge-drawer { transition: none; }
}
