/* Corkboard mockup 02 — "the workstation"
   Obsidian-frame investigator's tool: dark, dense, keyboard-first.
   A haystack instrument you live in, not a site you visit. */

:root {
  --bg: #17181c;
  --panel: #1d1f24;
  --panel2: #23252c;
  --panel3: #2a2d35;
  --line: #2e3138;
  --line-soft: #262930;
  --text: #d6d3ca;
  --soft: #9b978c;
  --faint: #6f6b62;
  --accent: #d77a4a;
  --accent-soft: rgba(215, 122, 74, .14);
  --corr: #5fb391;   --corr-soft: rgba(95, 179, 145, .13);
  --vol: #d9b45c;    --vol-soft: rgba(217, 180, 92, .13);
  --disp: #e07a70;   --disp-soft: rgba(224, 122, 112, .12);
  --para: #a98fe0;   --para-soft: rgba(169, 143, 224, .13);
  --pipe: #7da3c8;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --type: "American Typewriter", "Courier Prime", "Courier New", Courier, monospace;
  --k-sqlite: #6f9fd8;
  --k-pdf: #d87a6f;
  --k-json: #d8b26f;
  --k-docdb: #6fc094;
  --k-vault: #a98fe0;
  --k-case: #d77a4a;
  --sb-h: 25px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 13px; line-height: 1.5;
  overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; color: #e89468; }
::selection { background: rgba(215, 122, 74, .35); }
kbd {
  font-family: var(--mono); font-size: 9.5px; background: var(--panel3);
  border: 1px solid #3a3d46; border-bottom-width: 2px; border-radius: 3px;
  padding: 0 4px; color: var(--soft);
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #33363f; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3e424c; }
::-webkit-scrollbar-track { background: transparent; }

/* ═══ app frame ═══ */
#app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) auto;
  height: calc(100vh - var(--sb-h));
}
#main { display: flex; flex-direction: column; min-width: 0; }
#view { flex: 1; overflow-y: auto; padding: 18px 26px 60px; scroll-behavior: smooth; }

/* ═══ left sidebar ═══ */
#leftbar {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
#lb-top { display: flex; align-items: center; gap: 7px; padding: 10px 12px 8px; }
.pin {
  width: 11px; height: 11px; border-radius: 3px; flex: none;
  background: radial-gradient(circle at 35% 30%, #e89468, var(--accent) 70%);
}
.lb-brand { font-weight: 700; font-size: 13px; letter-spacing: .01em; }
.lb-board { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-left: auto; }
#lb-search { display: flex; align-items: center; gap: 6px; padding: 0 10px 8px; }
#tree-filter {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: 5px; color: var(--text); font: inherit; font-size: 12px;
  padding: 4px 8px; outline: none;
}
#tree-filter:focus { border-color: var(--accent); }
.lb-jump {
  font-family: var(--mono); font-size: 9.5px; color: var(--soft); cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px;
}
.lb-jump:hover { color: var(--text); border-color: var(--faint); }
#tree { flex: 1; overflow-y: auto; padding: 2px 6px 14px; }
#lb-foot {
  border-top: 1px solid var(--line); padding: 7px 12px;
  display: flex; align-items: center; gap: 8px;
}
.lb-triage { font-size: 12px; color: var(--soft); font-weight: 600; }
.lb-triage:hover { color: var(--text); }
.lb-help {
  margin-left: auto; cursor: pointer; color: var(--faint);
  border: 1px solid var(--line); border-radius: 50%; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.lb-help:hover { color: var(--text); border-color: var(--faint); }
.navbadge {
  display: inline-block; min-width: 15px; text-align: center;
  background: var(--disp); color: #1a1210; border-radius: 8px;
  font-size: 9.5px; font-weight: 700; padding: 1px 4px; vertical-align: 1px;
}

/* tree */
.tgroup { margin-top: 6px; }
.tgroup-head {
  display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); padding: 4px 6px; border-radius: 4px;
}
.tgroup-head:hover { color: var(--soft); background: var(--panel2); }
.tgroup-head .tw { width: 10px; display: inline-block; transition: transform .12s; font-size: 9px; }
.tgroup.open > .tgroup-head .tw { transform: rotate(90deg); }
.tgroup-head .tcount { margin-left: auto; font-weight: 400; letter-spacing: 0; }
.tgroup-body { display: none; }
.tgroup.open > .tgroup-body { display: block; }
.titem {
  display: flex; align-items: center; gap: 6px;
  padding: 2.5px 6px 2.5px 18px; border-radius: 4px; cursor: pointer;
  color: var(--soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.titem:hover { background: var(--panel2); color: var(--text); }
.titem.active { background: var(--accent-soft); color: var(--text); }
.titem .ti-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.titem .ti-meta { font-size: 10px; color: var(--faint); }
.ti-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.ti-dot.sq { border-radius: 2px; }
.tsub { padding-left: 14px; }

/* type / kind colors */
.c-person { background: #c8a2d8; }
.c-company { background: #d8b26f; }
.c-organization { background: #7da3c8; }
.c-law { background: #6fc094; }
.c-place { background: #d87a6f; }
.c-radio { background: #a98fe0; }
.c-group { background: #9b978c; }
.c-sqlite { background: var(--k-sqlite); }
.c-pdf { background: var(--k-pdf); }
.c-json { background: var(--k-json); }
.c-docdb { background: var(--k-docdb); }
.c-vault { background: var(--k-vault); }
.c-case { background: var(--k-case); }

/* ═══ tab bar ═══ */
#tabbar {
  display: flex; align-items: stretch; background: var(--panel);
  border-bottom: 1px solid var(--line); min-height: 34px; overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  display: flex; align-items: center; gap: 7px; padding: 0 10px 0 12px;
  border-right: 1px solid var(--line); cursor: pointer; user-select: none;
  color: var(--soft); font-size: 12px; max-width: 210px; min-width: 90px; flex: 0 1 auto;
  position: relative; background: var(--panel);
}
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active { background: var(--bg); color: var(--text); box-shadow: inset 0 2px 0 var(--accent); }
.tab .t-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; }
.tab .t-x {
  width: 16px; height: 16px; border-radius: 4px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 13px; visibility: hidden;
}
.tab:hover .t-x, .tab.active .t-x { visibility: visible; }
.tab .t-x:hover { background: var(--panel3); color: var(--text); }
.tab.flash { animation: tabflash 1s ease; }
@keyframes tabflash { 0% { background: var(--accent-soft); } 100% {} }
.tab-new {
  display: flex; align-items: center; padding: 0 12px; cursor: pointer;
  color: var(--faint); font-size: 16px;
}
.tab-new:hover { color: var(--text); }

/* ═══ right sidebar ═══ */
#rightbar {
  display: flex; flex-direction: row-reverse; background: var(--panel);
  border-left: 1px solid var(--line); width: 336px; min-height: 0;
}
#rightbar.collapsed { width: 34px; }
#rightbar.collapsed #rb-body { display: none; }
#rb-tabs {
  width: 34px; flex: none; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding-top: 8px; border-left: 1px solid var(--line-soft);
}
.rbt {
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 13px; user-select: none;
}
.rbt:hover { background: var(--panel3); color: var(--text); }
.rbt.active { background: var(--accent-soft); color: var(--accent); }
.rbt-collapse { margin-top: auto; margin-bottom: 8px; }
#rb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.rb-section { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 10px 12px; }
.rb-head {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); margin-bottom: 8px; flex: none;
}
.rb-hint { font-weight: 400; text-transform: none; letter-spacing: 0; font-style: italic; margin-left: 4px; }

/* context section */
.ctx-block { margin-bottom: 14px; }
.ctx-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--soft); margin-bottom: 5px; }
.ctx-item {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 4px;
  font-size: 12px; color: var(--soft); cursor: pointer;
}
.ctx-item:hover { background: var(--panel2); color: var(--text); }
.ctx-item .ci-meta { margin-left: auto; font-size: 10px; color: var(--faint); white-space: nowrap; }
.ctx-empty { font-size: 11.5px; color: var(--faint); font-style: italic; }

/* notes section */
.notes-tabs { display: flex; gap: 4px; margin-bottom: 8px; flex: none; }
.ntab {
  font-size: 11px; padding: 3px 9px; border-radius: 5px; cursor: pointer;
  color: var(--soft); border: 1px solid transparent;
}
.ntab:hover { background: var(--panel2); }
.ntab.active { background: var(--panel3); color: var(--text); border-color: var(--line); }
#notes-text {
  flex: none; height: 42%; min-height: 140px; resize: vertical;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font: inherit; font-size: 12.5px; line-height: 1.55;
  padding: 9px 10px; outline: none;
}
#notes-text:focus { border-color: var(--accent); }
#pinned-notes { margin-top: 10px; overflow-y: auto; }
.pinned {
  background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--para);
  border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; font-size: 12px;
}
.pinned .pin-meta { font-size: 10px; color: var(--faint); margin-top: 5px; display: flex; gap: 6px; align-items: center; }
.pinned .pin-meta a { font-size: 10px; }
.pinned .pin-x { margin-left: auto; cursor: pointer; color: var(--faint); }
.pinned .pin-x:hover { color: var(--disp); }

/* agent section */
#chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.msg { max-width: 92%; border-radius: 9px; padding: 7px 10px; font-size: 12.5px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid rgba(215,122,74,.3); }
.msg.agent { align-self: flex-start; background: var(--panel2); border: 1px solid var(--line); }
.msg.agent .m-act {
  display: block; font-family: var(--mono); font-size: 10px; color: var(--para);
  margin-top: 5px;
}
.msg.typing { color: var(--faint); font-style: italic; }
.msg.typing::after { content: "…"; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
#chat-suggestions { flex: none; display: flex; flex-direction: column; gap: 5px; padding: 8px 0; }
.sugg {
  font-size: 11.5px; color: var(--soft); border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 9px; cursor: pointer; background: var(--panel2);
}
.sugg:hover { border-color: var(--accent); color: var(--text); }
#chat-inputrow { flex: none; display: flex; gap: 6px; }
#chat-input {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font: inherit; font-size: 12.5px; padding: 6px 9px; outline: none;
}
#chat-input:focus { border-color: var(--accent); }
#chat-send {
  background: var(--accent); color: #1a1210; border: none; border-radius: 6px;
  font-size: 14px; font-weight: 700; width: 32px; cursor: pointer;
}
#chat-send:hover { background: #e89468; }

/* trail section */
#trail-list { flex: 1; overflow-y: auto; }
.tstop {
  display: flex; align-items: center; gap: 7px; padding: 3px 6px; border-radius: 4px;
  font-size: 12px; color: var(--soft); cursor: pointer; position: relative;
}
.tstop::before { content: ""; position: absolute; left: 8.5px; top: -6px; bottom: -6px; width: 1px; background: var(--line); }
.tstop:first-child::before { top: 50%; }
.tstop:last-child::before { bottom: 50%; }
.tstop .ti-dot { z-index: 1; outline: 3px solid var(--panel); }
.tstop:hover { background: var(--panel2); color: var(--text); }
.tstop.current { color: var(--text); font-weight: 600; }
.tstop .ts-time { margin-left: auto; font-size: 9.5px; color: var(--faint); }
.trail-actions { flex: none; display: flex; gap: 6px; padding-top: 8px; }
#saved-trails { flex: none; padding-top: 10px; }
.strail {
  display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 4px;
  font-size: 12px; color: var(--soft); cursor: pointer;
}
.strail:hover { background: var(--panel2); color: var(--text); }
.strail .ti-meta { margin-left: auto; font-size: 10px; color: var(--faint); }

/* ═══ status bar ═══ */
#statusbar {
  height: var(--sb-h); display: flex; align-items: center; gap: 16px;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 0 12px; font-size: 10.5px; color: var(--faint);
  white-space: nowrap; overflow: hidden;
}
.status-addr { font-family: var(--mono); font-size: 10px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; }
.status-flex { flex: 1; }
.status-mock { color: #8a6a4f; }
#status-agent { color: var(--para); font-weight: 600; }
.status-dim kbd { vertical-align: 0; }

/* ═══ generic bits ═══ */
.btn {
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--soft);
}
.btn:hover { border-color: var(--faint); color: var(--text); }
.btn.primary { background: var(--accent); color: #1a1210; border-color: var(--accent); }
.btn.primary:hover { background: #e89468; }
.hint { font-size: 11px; color: var(--faint); font-style: italic; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px;
}
.card + .card { margin-top: 10px; }
.card h3 {
  margin: 0 0 8px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--faint); font-weight: 700;
}
.crumbs { font-size: 11px; color: var(--faint); margin-bottom: 10px; }
.crumbs a { color: var(--faint); }
.crumbs a:hover { color: var(--accent); }
.empty { text-align: center; color: var(--faint); padding: 40px 0; font-style: italic; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; line-height: 1; padding: 3px 7px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--soft);
  white-space: nowrap; vertical-align: middle;
}
.chip.mono { font-family: var(--mono); font-size: 9.5px; }
.chip-vol  { background: var(--vol-soft);  border-color: rgba(217,180,92,.4);  color: var(--vol); }
.chip-corr { background: var(--corr-soft); border-color: rgba(95,179,145,.4);  color: var(--corr); }
.chip-disp { background: var(--disp-soft); border-color: rgba(224,122,112,.4); color: var(--disp); }
.chip-para { background: var(--para-soft); border-color: rgba(169,143,224,.4); color: var(--para); }
.chip-un   { color: var(--faint); }
.chip-via  { background: var(--vol-soft); border-color: rgba(217,180,92,.35); color: var(--vol); font-style: italic; }

.addr {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px 2px 5px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--panel2);
  color: var(--soft); cursor: pointer; text-decoration: none;
  font-family: var(--mono); font-size: 10px;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.addr:hover { border-color: var(--faint); color: var(--text); }
.addr::before { content: ""; width: 6px; height: 6px; border-radius: 2px; flex: none; }
.addr.k-sqlite::before { background: var(--k-sqlite); }
.addr.k-pdf::before    { background: var(--k-pdf); }
.addr.k-json::before   { background: var(--k-json); }
.addr.k-docdb::before  { background: var(--k-docdb); }
.addr.k-vault::before  { background: var(--k-vault); }
.addr.k-case::before   { background: var(--k-case); border-radius: 50%; }

.kindtag {
  display: inline-block; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 2px 6px; border-radius: 4px; border: 1px solid;
}
.kindtag.k-sqlite { color: var(--k-sqlite); border-color: rgba(111,159,216,.4); }
.kindtag.k-pdf    { color: var(--k-pdf);    border-color: rgba(216,122,111,.4); }
.kindtag.k-json   { color: var(--k-json);   border-color: rgba(216,178,111,.4); }
.kindtag.k-docdb  { color: var(--k-docdb);  border-color: rgba(111,192,148,.4); }
.kindtag.k-vault  { color: var(--k-vault);  border-color: rgba(169,143,224,.4); }
.kindtag.k-case   { color: var(--k-case);   border-color: rgba(215,122,74,.4); }

/* grade chips (haystack: rumour & hearsay wear their grade) */
.grade { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 4px; }
.grade-documented { background: var(--corr-soft); color: var(--corr); }
.grade-reported { background: rgba(125,163,200,.15); color: var(--pipe); }
.grade-hearsay { background: var(--vol-soft); color: var(--vol); }
.grade-rumour { background: var(--disp-soft); color: var(--disp); }

/* ═══ content typography ═══ */
.page-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
h1.page-name { font-size: 23px; line-height: 1.2; margin: 2px 0 8px; font-weight: 700; letter-spacing: -0.01em; }
.ent-anchor-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.ent-aliases { font-size: 11px; color: var(--faint); font-style: italic; }

.signal-strip { display: flex; gap: 14px; margin: 12px 0 16px; flex-wrap: wrap; align-items: center; font-size: 11px; color: var(--faint); }
.signal-strip b { font-size: 15px; font-weight: 700; margin-right: 3px; }
.sig { display: inline-flex; align-items: baseline; gap: 2px; padding: 3px 0; }
.sig.s-vol b { color: var(--vol); }
.sig.s-corr b { color: var(--corr); }
.sig.s-disp b { color: var(--disp); }
.sig-sep { color: var(--line); }

.ent-summary { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0 0 6px; max-width: 640px; }

.reading { max-width: 760px; }
.reading h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--soft); margin: 22px 0 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

/* statements */
.stmt {
  position: relative; padding: 7px 9px 7px 12px; margin: 4px 0;
  border-radius: 6px; border-left: 2.5px solid transparent;
  font-size: 13px; line-height: 1.55; background: var(--panel);
  border-top: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
}
.stmt.v-corroborated { border-left-color: var(--corr); }
.stmt.v-supported { border-left-color: #3a3d46; }
.stmt.v-contested { border-left-color: var(--disp); background: linear-gradient(90deg, var(--disp-soft), var(--panel) 60%); }
.stmt.v-paraphrase { border-left-color: var(--para); background: linear-gradient(90deg, var(--para-soft), var(--panel) 60%); }
.stmt.v-unsourced { border-left-color: transparent; border-left-style: dashed; }
.stmt.v-rumour, .stmt.v-hearsay { border-left-color: var(--vol); border-left-style: dashed; background: linear-gradient(90deg, var(--vol-soft), var(--panel) 55%); }
.stmt .stmt-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; align-items: center; }
.stmt .prov-btn { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 4px; }
.stmt .prov-btn:hover .chip { border-color: var(--faint); }
.agent-flash { animation: agentflash 1.8s ease; }
@keyframes agentflash {
  0% { outline: 2px solid var(--para); outline-offset: 2px; background: var(--para-soft); }
  100% { outline: 2px solid transparent; outline-offset: 2px; }
}

.rival { margin-top: 6px; padding: 7px 10px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-size: 12.5px; }
.rival .rival-who { font-size: 10px; color: var(--faint); margin-top: 3px; }
.rival.deny { border-color: rgba(224,122,112,.45); }

/* connections (edge rows on entity pages) */
.connrow {
  display: flex; align-items: center; gap: 9px; padding: 6px 9px; margin: 3px 0;
  border: 1px solid var(--line-soft); border-radius: 6px; cursor: pointer;
  background: var(--panel); font-size: 13px;
}
.connrow:hover { background: var(--panel2); border-color: var(--line); }
.connrow .cr-name { font-weight: 600; color: var(--text); }
.connrow .cr-rel { color: var(--faint); font-size: 11.5px; font-style: italic; }
.connrow .cr-dots { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.vdot { width: 8px; height: 8px; border-radius: 50%; }
.vdot.v-corroborated { background: var(--corr); }
.vdot.v-supported { background: #4a4e58; }
.vdot.v-contested { background: var(--disp); }
.vdot.v-paraphrase { background: var(--para); }
.vdot.v-unsourced { background: transparent; border: 1px dashed var(--faint); }
.vdot.v-rumour, .vdot.v-hearsay { background: var(--vol); }
.connrow .cr-arrow { color: var(--faint); font-size: 14px; }

/* edge page */
.edge-endpoints {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center;
  margin: 10px 0 14px;
}
.edge-end {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px;
  background: var(--panel); cursor: pointer;
}
.edge-end:hover { border-color: var(--accent); }
.edge-end .ee-type { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.edge-end .ee-name { font-weight: 700; font-size: 15px; color: var(--text); }
.edge-mid { text-align: center; color: var(--faint); font-size: 20px; }
.edge-mid .em-rels { display: block; font-size: 10px; font-style: italic; max-width: 150px; }

/* ═══ tables ═══ */
table.data { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
table.data th {
  text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); font-weight: 700; padding: 5px 9px;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel);
}
table.data td { padding: 4.5px 9px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--soft); }
table.data tr.rowlink { cursor: pointer; }
table.data tr.rowlink:hover td { background: var(--panel3); color: var(--text); }
table.data td.num, table.data th.num { text-align: right; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; }

/* ═══ datum pages ═══ */
.datum-addr {
  font-family: var(--mono); font-size: 13px; padding: 8px 12px;
  background: #101114; border: 1px solid var(--line); color: #d8d0bd; border-radius: 7px;
  margin-bottom: 4px; overflow-x: auto; white-space: nowrap;
}
.datum-addr .seg { color: #6f6b62; }
.datum-addr .val { color: #e8c07a; }
.datum-sub { font-size: 11px; color: var(--faint); margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.fieldlist { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.fieldlist .frow { display: grid; grid-template-columns: 175px 1fr; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.fieldlist .frow:last-child { border-bottom: none; }
.fieldlist .fkey { padding: 5px 11px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); background: var(--panel2); border-right: 1px solid var(--line-soft); }
.fieldlist .fval { padding: 5px 11px; font-size: 12.5px; color: var(--text); }

/* declassified memo — paper stays paper, lit on the dark desk */
.memo {
  background: #f6f2e6; border: 1px solid #4a4538; border-radius: 3px;
  box-shadow: 0 6px 26px rgba(0,0,0,.5);
  max-width: 620px; margin: 0 auto; padding: 40px 48px 48px;
  font-family: var(--type); font-size: 13px; line-height: 1.75; color: #2a251c;
  position: relative;
}
.memo .stamp {
  position: absolute; font-weight: 700; letter-spacing: .16em; text-align: center;
  border: 2.5px solid; padding: 2px 12px; transform: rotate(-7deg); opacity: .8; font-size: 12px;
}
.memo .stamp.declass { top: 14px; right: 24px; color: #4b6e9e; border-color: #4b6e9e; transform: rotate(4deg); font-size: 9px; line-height: 1.5; padding: 3px 8px; }
.memo .stamp.secret { top: 12px; left: 42%; color: #a83434; border-color: #a83434; text-decoration: line-through; }
.memo h4 { text-align: center; font-size: 13px; margin: 16px 0 4px; letter-spacing: .04em; }
.memo .memo-meta { text-align: center; font-size: 11.5px; margin-bottom: 20px; }
.memo p { margin: 12px 0; }
.memo .redact { background: #1c1a15; color: transparent; border-radius: 1px; padding: 0 3px; user-select: none; }
.memo .hl { background: #ffe9a3; padding: 1px 3px; border-radius: 2px; box-shadow: 0 0 0 1px #cfae55; }
.memo .pageno { text-align: center; font-size: 10.5px; margin-top: 30px; color: #6b6353; }
.pdf-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 6px; font-size: 11.5px; color: var(--faint); }
.hl-jump { font-size: 11px; color: var(--faint); text-align: center; margin-bottom: 10px; }

/* json */
.jsonview {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  background: #101114; color: #c9c2b2; border: 1px solid var(--line); border-radius: 7px;
  padding: 14px 18px; overflow-x: auto; white-space: pre;
}
.jsonview .jk { color: #8fb573; }
.jsonview .js { color: #e0b064; }
.jsonview .jn { color: #7fb4d8; }
.jsonview .jhl-line {
  background: rgba(255, 233, 163, .12); display: inline-block;
  width: calc(100% + 36px); margin: 0 -18px; padding: 0 18px;
  box-sizing: border-box; box-shadow: inset 3px 0 0 #e0b064;
}

/* docdb article — newsprint card */
.docdb-doc { max-width: 640px; }
.article-card {
  background: #f2eee2; color: #262119; border-radius: 3px; border: 1px solid #4a4538;
  box-shadow: 0 6px 26px rgba(0,0,0,.5); padding: 30px 38px;
}
.article-head { font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.2; margin: 4px 0 2px; }
.article-meta { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: #6b6353; margin-bottom: 10px; }
.article-body { font-family: var(--serif); font-size: 14.5px; line-height: 1.65; }
.article-body p:first-child::first-letter { font-size: 2em; float: left; line-height: .95; padding-right: 5px; font-weight: 600; }
.junket-flag { display: inline-block; background: #f0e3c0; color: #7a5c12; border: 1px solid #cfae55; font-size: 10px; border-radius: 4px; padding: 1px 7px; }

/* read/unread */
.readdot { width: 7px; height: 7px; border-radius: 50%; background: var(--vol); flex: none; display: inline-block; }
.readdot.isread { background: #3a3d46; }
.readtoggle { cursor: pointer; font-size: 11px; color: var(--faint); border: 1px solid var(--line); padding: 2px 8px; border-radius: 5px; user-select: none; }
.readtoggle:hover { border-color: var(--faint); color: var(--text); }
.readbar { flex: 1; height: 4px; border-radius: 2px; background: var(--panel3); overflow: hidden; min-width: 40px; }
.readbar i { display: block; height: 100%; background: var(--corr); border-radius: 2px; }

/* ═══ notes (vault) ═══ */
.note-body { font-size: 13.5px; line-height: 1.65; max-width: 680px; color: var(--text); }
.note-body h1 { font-size: 20px; margin: 6px 0 10px; }
.note-body h2 { font-size: 16px; margin: 20px 0 6px; }
.note-body p { margin: 10px 0; }
.note-body blockquote { border-left: 3px solid var(--line); margin: 12px 0; padding: 2px 0 2px 14px; color: var(--soft); font-style: italic; }
.note-body ul, .note-body ol { padding-left: 24px; }
.note-body li { margin: 4px 0; }
.note-body code { font-family: var(--mono); font-size: .85em; background: var(--panel3); padding: 1px 5px; border-radius: 4px; color: var(--soft); }
.wikilink { border-bottom: 1px dashed rgba(215,122,74,.5); }
.wikilink:hover { border-bottom-style: solid; }
.wikilink.missing { color: var(--faint); border-bottom-color: var(--line); }

.queryblock { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; overflow: hidden; background: var(--panel); }
.qb-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--panel2); border-bottom: 1px solid var(--line-soft); font-size: 10.5px; color: var(--soft);
}
.qb-head .qb-live { display: inline-flex; align-items: center; gap: 4px; color: var(--corr); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; font-size: 9.5px; }
.qb-live .livedot { width: 6px; height: 6px; border-radius: 50%; background: var(--corr); animation: pulse 2.2s infinite; }
.qb-head .qb-rerun { margin-left: auto; }
.qb-code {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  padding: 9px 12px; color: var(--soft); background: #101114;
  border-bottom: 1px solid var(--line-soft); white-space: pre; overflow-x: auto;
}
.qb-code .kw { color: var(--k-sqlite); font-weight: 600; }
.qb-result { padding: 4px; }
.qb-result .tablewrap { border: none; }
.qb-result.flash { animation: qflash .55s; }
@keyframes qflash { 0% { background: var(--corr-soft); } 100% { background: transparent; } }
.qb-foot { font-size: 10px; color: var(--faint); padding: 3px 10px 7px; }

/* ═══ findings ═══ */
.finding-status { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; padding: 2px 7px; border-radius: 4px; }
.fs-corroborated { background: var(--corr-soft); color: var(--corr); }
.fs-contested { background: var(--disp-soft); color: var(--disp); }
.fs-developing { background: var(--vol-soft); color: var(--vol); }

.participants { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 7px; }
.participant { border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: var(--panel); }
.participant .role { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.participant a { font-weight: 600; font-size: 12.5px; }

.timeline { position: relative; margin: 8px 0 8px 6px; padding-left: 20px; border-left: 1.5px solid var(--line); }
.tl-item { position: relative; margin-bottom: 13px; }
.tl-item::before {
  content: ""; position: absolute; left: -25.5px; top: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e89468, var(--accent) 70%);
}
.tl-date { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.tl-text { font-size: 13px; margin: 1px 0 3px; color: var(--text); }
.tl-srcs { display: flex; flex-wrap: wrap; gap: 4px; }

.dispute-box { border: 1px solid rgba(224,122,112,.4); background: var(--disp-soft); border-radius: 8px; padding: 11px 13px; margin: 10px 0; }
.dispute-box .dq { font-weight: 650; font-size: 13.5px; margin-bottom: 8px; }
.position { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; margin-top: 7px; font-size: 12.5px; }
.position .pos-who { font-size: 10px; color: var(--faint); margin-top: 4px; }

/* ═══ home ═══ */
.home-cols { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .home-cols { grid-template-columns: 1fr; } }
.statline { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 16px; font-size: 11px; color: var(--faint); }
.statline b { font-size: 16px; color: var(--text); margin-right: 3px; }
.statline .warn b { color: var(--disp); }
.statline .volb b { color: var(--vol); }
.leadrow { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--soft); cursor: pointer; border-radius: 3px; }
.leadrow:hover { background: var(--panel2); color: var(--text); }
.leadrow:last-child { border-bottom: none; }
.leadrow .lead-name { font-weight: 600; color: var(--text); }
.leadrow .lead-type { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.volbar { flex: 1; height: 5px; background: var(--panel3); border-radius: 3px; margin: 0 4px; overflow: hidden; min-width: 30px; }
.volbar i { display: block; height: 100%; background: var(--vol); border-radius: 3px; }
.leadrow .leadcount { font-variant-numeric: tabular-nums; color: var(--vol); font-weight: 700; font-size: 11px; width: 54px; text-align: right; white-space: nowrap; }

/* ═══ triage tabs ═══ */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ttab { padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--soft); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ttab.active { color: var(--text); border-bottom-color: var(--accent); }
.triage-item { margin-bottom: 10px; }
.corpus-row { display: flex; align-items: center; gap: 9px; padding: 6px 6px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--soft); }
.corpus-row .cr-title { font-weight: 600; color: var(--accent); cursor: pointer; }
.corpus-row .cr-meta { color: var(--faint); font-size: 10.5px; }
.corpus-row .spacer { flex: 1; }

/* ═══ source cards ═══ */
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.source-card { display: block; color: var(--text); cursor: pointer; }
.source-card:hover { border-color: var(--faint); }
.source-card .sc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.source-card .sc-title { font-weight: 650; font-size: 13px; }
.source-card .sc-desc { font-size: 11.5px; color: var(--soft); margin-bottom: 8px; }
.source-card .sc-meta { display: flex; gap: 10px; font-size: 10.5px; color: var(--faint); align-items: center; }

/* agent view (what an agent sees here) */
.agentview { border: 1px solid rgba(169,143,224,.35); border-radius: 8px; margin-top: 16px; background: var(--panel); overflow: hidden; }
.av-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; user-select: none;
  background: var(--para-soft); color: var(--para); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
}
.av-head .tw { transition: transform .12s; font-size: 9px; }
.agentview.open .av-head .tw { transform: rotate(90deg); }
.av-body { display: none; padding: 10px 12px; }
.agentview.open .av-body { display: block; }
.av-block { margin-bottom: 10px; }
.av-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-bottom: 3px; }
.av-pre {
  font-family: var(--mono); font-size: 11px; line-height: 1.55; color: #c9c2b2;
  background: #101114; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 11px; white-space: pre; overflow-x: auto;
}
.av-note { font-size: 11px; color: var(--soft); font-style: italic; }

/* ═══ provenance panel ═══ */
#overlay { position: fixed; inset: 0; background: rgba(5,5,8,.55); z-index: 90; }
#prov-panel {
  position: fixed; top: 0; right: 0; bottom: var(--sb-h); width: min(470px, 94vw); z-index: 95;
  background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -14px 0 44px rgba(0,0,0,.5);
  overflow-y: auto; padding: 18px 20px 34px;
}
.prov-head { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); display: flex; align-items: center; }
.prov-close { margin-left: auto; cursor: pointer; font-size: 18px; color: var(--faint); line-height: 1; padding: 2px 6px; border-radius: 5px; }
.prov-close:hover { background: var(--panel3); color: var(--text); }
.prov-claim { font-size: 14.5px; line-height: 1.55; margin: 10px 0 4px; color: var(--text); }
.prov-subject { font-size: 11px; color: var(--faint); margin-bottom: 10px; }
.prov-verdict { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px 11px; border-radius: 7px; margin: 10px 0 14px; font-size: 12px; color: var(--text); }
.prov-verdict.v-contested { background: var(--disp-soft); }
.prov-verdict.v-corroborated { background: var(--corr-soft); }
.prov-verdict.v-supported { background: var(--panel2); }
.prov-verdict.v-paraphrase { background: var(--para-soft); }
.prov-verdict.v-unsourced { background: var(--panel2); }
.prov-verdict.v-rumour, .prov-verdict.v-hearsay { background: var(--vol-soft); }
.prov-section { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 14px 0 7px; }
.entry { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--panel2); }
.entry-head { display: flex; align-items: center; gap: 7px; font-size: 12px; flex-wrap: wrap; }
.rec-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text); }
.rec-badge .rec-dot { width: 7px; height: 7px; border-radius: 50%; }
.rec-human .rec-dot { background: var(--accent); }
.rec-pipe .rec-dot { background: var(--pipe); border-radius: 2px; }
.rec-kind { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.stance { margin-left: auto; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 4px; }
.stance.assert { background: var(--corr-soft); color: var(--corr); }
.stance.deny { background: var(--disp-soft); color: var(--disp); }
.entry-time { font-size: 10px; color: var(--faint); }
.entry-note { font-size: 11.5px; color: var(--soft); margin: 5px 0 2px; font-style: italic; }
.entry-srcs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.entry-content { font-size: 12.5px; margin: 5px 0 2px; color: var(--text); }
.prov-collapse-note {
  font-size: 11.5px; color: var(--text); background: var(--vol-soft);
  border: 1px solid rgba(217,180,92,.35); border-radius: 6px; padding: 7px 10px; margin-top: 8px;
}
.prov-actions { display: flex; gap: 6px; margin-top: 16px; }
.mock-note { font-size: 10px; color: var(--faint); font-style: italic; margin-top: 6px; }

/* ═══ ego graph ═══ */
.egograph { width: 100%; height: auto; display: block; }
.egograph text { font-family: var(--sans); fill: var(--soft); }
.egograph .eg-node { cursor: pointer; }
.egograph .eg-node:hover circle { stroke: var(--accent); stroke-width: 2; }
.graph-note { font-size: 10px; color: var(--faint); font-style: italic; margin-top: 4px; }

/* ═══ quick switcher ═══ */
#switcher-wrap {
  position: fixed; inset: 0; z-index: 120; background: rgba(5,5,8,.55);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
#switcher {
  width: min(600px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 18px 60px rgba(0,0,0,.6); overflow: hidden;
}
#switcher-input {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 15px; padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
#switcher-results { max-height: 46vh; overflow-y: auto; padding: 5px; }
.sw-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 6px;
  cursor: pointer; color: var(--soft); font-size: 13px;
}
.sw-item .sw-name { color: var(--text); }
.sw-item .sw-name b { color: var(--accent); font-weight: 700; }
.sw-item .sw-meta { margin-left: auto; font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.sw-item.sel { background: var(--accent-soft); }
.switcher-foot { padding: 7px 14px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--faint); }

/* ═══ hover preview ═══ */
#hoverpreview {
  position: fixed; z-index: 110; width: 340px; max-height: 300px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 14px 44px rgba(0,0,0,.55); padding: 12px 14px; font-size: 12px;
  pointer-events: none;
}
#hoverpreview .hp-type { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
#hoverpreview .hp-name { font-weight: 700; font-size: 14px; color: var(--text); margin: 1px 0 5px; }
#hoverpreview .hp-body { color: var(--soft); line-height: 1.5; }
#hoverpreview .hp-body .memo-mini {
  font-family: var(--type); background: #f6f2e6; color: #2a251c; border-radius: 3px;
  padding: 8px 10px; font-size: 10.5px; line-height: 1.6; margin-top: 5px;
}
#hoverpreview .hp-meta { margin-top: 7px; display: flex; gap: 5px; flex-wrap: wrap; }

/* ═══ help modal ═══ */
#helpmodal-wrap {
  position: fixed; inset: 0; z-index: 120; background: rgba(5,5,8,.55);
  display: flex; align-items: center; justify-content: center;
}
#helpmodal {
  width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 18px 60px rgba(0,0,0,.6); padding: 20px 24px;
}
#helpmodal h2 { margin: 0 0 12px; font-size: 15px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; font-size: 12.5px; color: var(--soft); }
.help-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }

/* toast */
#toast {
  position: fixed; bottom: 38px; left: 50%; transform: translateX(-50%);
  background: var(--panel3); color: var(--text); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 8px; font-size: 12px; z-index: 200; max-width: 480px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); transition: opacity .3s; line-height: 1.45;
}

@media (max-width: 1150px) {
  #app { grid-template-columns: 200px minmax(0,1fr) auto; }
  #rightbar { width: 300px; }
}
@media (max-width: 900px) {
  #app { grid-template-columns: minmax(0,1fr); }
  #leftbar, #rightbar { display: none; }
}
