/* ============================================================
   T笔记 · 目录 / 缩略图面板
   ============================================================ */

#tocPanel{
  position:absolute;left:0;top:0;bottom:0;width:312px;z-index:36;
  background:var(--card);border-right:1px solid var(--line);
  box-shadow:6px 0 26px rgba(23,32,48,.12);
  display:flex;flex-direction:column;
  animation:tocIn .18s ease-out;
}
@keyframes tocIn{from{transform:translateX(-14px);opacity:.4;}to{transform:none;opacity:1;}}

.toc-head{
  flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;
  gap:8px;padding:10px 10px 10px 12px;border-bottom:1px solid var(--line);
}
.toc-tabs{display:flex;gap:4px;background:#f1f5fa;border-radius:10px;padding:3px;}
.toc-tab{
  height:32px;padding:0 12px;border-radius:8px;
  display:flex;align-items:center;gap:6px;
  font-size:13px;color:#5b6474;transition:background .15s,color .15s;
}
.toc-tab:active{background:#e6ecf7;}
.toc-tab.active{background:#fff;color:var(--brand);box-shadow:var(--shadow-s);font-weight:600;}

.toc-body{flex:1;overflow:auto;padding:8px;}

/* ---------- 目录树 ---------- */
.toc-list{list-style:none;margin:0;padding:0;}
.toc-item{
  display:flex;align-items:center;gap:8px;
  padding:8px 10px;border-radius:9px;cursor:pointer;
  font-size:13.5px;line-height:1.35;color:#38414f;
}
.toc-item:hover{background:#f4f7fc;}
.toc-item:active{background:#e9effa;}
.toc-item .tt{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.toc-item .pg{
  flex:0 0 auto;font-size:11.5px;color:var(--muted);
  font-variant-numeric:tabular-nums;
}
.toc-item.current{background:var(--brand-soft);color:var(--brand-dark);font-weight:600;}
.toc-item.current .pg{color:var(--brand);}

/* ---------- 缩略图 ---------- */
.toc-thumbs{display:flex;flex-direction:column;gap:12px;padding:4px 2px;}
.thumb-item{
  display:flex;flex-direction:column;align-items:center;gap:6px;
  padding:8px;border-radius:10px;cursor:pointer;
}
.thumb-item:hover{background:#f4f7fc;}
.thumb-item .tbox{
  width:100%;background:#fff;border:1px solid var(--line);border-radius:6px;
  overflow:hidden;box-shadow:var(--shadow-s);
  display:flex;align-items:center;justify-content:center;
}
.thumb-item canvas{display:block;width:100%;height:auto;}
.thumb-item .tno{font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums;}
.thumb-item.current .tbox{border-color:var(--brand);box-shadow:0 0 0 2px var(--brand-soft);}
.thumb-item.current .tno{color:var(--brand);font-weight:700;}

.toc-empty{
  padding:20px 14px;font-size:13px;color:var(--muted);
  text-align:center;line-height:1.8;
}

/* 窄屏：面板占满整个画布区 */
@media (max-width:900px){
  #tocPanel{width:min(86vw,340px);}
}
