/* ===== 任务管理：树形层级 ===== */
.task-tree { font-size: 14.5px; }
.task-tree ul {
  list-style: none; margin: 0; padding-left: 20px; position: relative;
}
.task-tree li { position: relative; }
.task-tree ul li::before {
  content: ''; position: absolute; left: -14px; top: -6px;
  width: 11px; height: 22px;
  border-left: 2px solid #d8dee9;
  border-bottom: 2px solid #d8dee9;
  border-bottom-left-radius: 6px;
}
.task-tree > ul > li::before { border: none; }
.task-tree ul li:last-child::before { height: 12px; }

.tn-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.task-tree > ul > li > .tn-row {
  background: #f1f5f9; border-color: #dbe4ee; font-weight: 600;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.task-tree > ul > li > ul > li > .tn-row {
  background: #fff; border-left: 3px solid #bfdbfe;
}
.task-tree > ul > li > ul > li > ul > li > .tn-row {
  background: #fbfdff; border-left-color: #cbd5e1;
}
.task-tree > ul > li > ul > li > ul > li > ul > li > .tn-row {
  background: #f8fafc; border-left-color: #e2e8f0;
}
.tn-row:hover { background: #f1f5f9; }
.task-tree > ul > li > .tn-row:hover { background: #e2e8f0; }
.task-tree > ul > li > ul > li > .tn-row:hover,
.task-tree > ul > li > ul > li > ul > li > .tn-row:hover,
.task-tree > ul > li > ul > li > ul > li > ul > li > .tn-row:hover { background: #eff6ff; }
.tn-row.selected {
  background: var(--accent-soft); border-color: #c7d2fe;
  box-shadow: inset 3px 0 0 var(--accent);
}
.tn-toggle {
  width: 20px; height: 20px; flex: 0 0 20px; border: none; background: transparent;
  color: #64748b; font-size: 11px; border-radius: 5px; padding: 0;
  line-height: 1; display: flex; align-items: center; justify-content: center;
}
.tn-toggle:hover { background: #e2e8f0; }
.tn-dot {
  width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 2px 4px rgba(99,102,241,.35);
}
.tn-row.root > .tn-dot { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.tn-name {
  flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.tn-row.done .tn-name { text-decoration: line-through; }
.tn-counts { flex: 0 0 auto; display: flex; gap: 4px; }
.tn-counts .tag {
  font-size: 11px; color: #475569; background: #eef2ff;
  padding: 1px 6px; border-radius: 20px;
}
.tn-counts .tag.tag-remind {
  background: #fff7e6; color: #b45309; font-weight: 600;
  box-shadow: inset 0 0 0 1px #fcd34d;
}
.tn-counts .tag.tag-remind.sent {
  background: #eef2ff; color: #4f46e5; box-shadow: inset 0 0 0 1px #c7d2fe;
}
.tn-counts .tag.tag-done {
  background: #ecfdf5; color: #059669; font-weight: 600;
  box-shadow: inset 0 0 0 1px #a7f3d0;
}
.tn-ops { flex: 0 0 auto; display: none; gap: 2px; }
.tn-row:hover .tn-ops { display: inline-flex; }
.tn-ops button {
  width: 22px; height: 22px; border: none; background: #fff; color: #64748b;
  border-radius: 5px; font-size: 12px; line-height: 1; padding: 0;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.tn-ops button:hover { background: var(--accent); color: #fff; }
.tn-ops button.danger:hover { background: #dc2626; }

/* 折叠 */
.task-tree li.collapsed > ul { display: none; }

/* ===== 右侧层级详情 ===== */
.link-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 4px; border-radius: 8px;
}
.link-item:hover { background: #f8fafc; }
.link-item .lbody { flex: 1 1 auto; min-width: 0; }
.link-item .lbody .lt { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-item .lbody .lm { font-size: 12px; color: var(--muted); }
.link-item .lops { flex: 0 0 auto; display: flex; gap: 4px; }

/* ===== 关联已有选择器 ===== */
.pick-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.pick-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer;
}
.pick-item:hover { background: #f1f5f9; }
.pick-item.checked { background: var(--accent-soft); }
.pick-item input { flex: 0 0 auto; }
.pick-item .pname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pick-item .pmeta { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.pick-empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 13.5px; }

/* 快捷新建笔记（Quill）弹窗：压缩编辑区高度，适配 modal 内展示 */
.note-editor.quick-note-editor .ql-toolbar { border-radius: 8px 8px 0 0; }
.note-editor.quick-note-editor .ql-container { border-radius: 0 0 8px 8px; }
.note-editor.quick-note-editor .ql-editor { min-height: 30vh; max-height: 45vh; overflow-y: auto; }

/* 编辑任务弹窗：任务描述富文本编辑器 */
.note-editor.task-note-editor .ql-toolbar { border-radius: 8px 8px 0 0; }
.note-editor.task-note-editor .ql-container { border-radius: 0 0 8px 8px; }
.note-editor.task-note-editor .ql-editor { min-height: 160px; max-height: 32vh; overflow-y: auto; }

/* 任务详情区：富文本描述排版 */
#detailNote { line-height: 1.75; word-break: break-word; }
#detailNote p { margin-bottom: .5rem; }
#detailNote img { max-width: 100%; height: auto; }
#detailNote ul, #detailNote ol { padding-left: 1.4rem; margin-bottom: .5rem; }

/* 任务到点提醒弹窗：条目列表 */
.due-remind-list { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.rm-item { display: block; border: 1px solid #dee2e6; border-radius: 8px; padding: 10px 12px; color: inherit; background: #fff; }
.rm-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.rm-open { display: block; color: inherit; text-decoration: none; }
.rm-delay { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef0f2; }
.rm-delay span { color: #6c757d; font-size: 12px; margin-right: 2px; }
.rm-delay button { border: 1px solid #ced4da; border-radius: 5px; background: #fff; color: #495057; padding: 2px 7px; font-size: 12px; cursor: pointer; }
.rm-delay button:hover { border-color: var(--accent); color: var(--accent); background: #f8f9ff; }
.rm-delay button:disabled { opacity: .6; cursor: wait; }
.tag-assignee { color: #0f766e; background: #ccfbf1; }
.rm-head { display: flex; align-items: baseline; gap: 8px; }
.rm-title { font-weight: 600; font-size: 14.5px; }
.rm-time { margin-left: auto; flex: 0 0 auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.rm-path { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-desc { font-size: 13px; color: #6c757d; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== 任务搜索 ===== */
.tn-row.hit { background: #fffbeb; box-shadow: inset 0 0 0 1px #fcd34d; }
.tn-row.hit:hover { background: #fef3c7; }
.tn-row.selected.hit { background: #fef3c7; box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px #fcd34d; }
.task-tree mark { background: #fde047; border-radius: 3px; padding: 0 1px; color: inherit; }

/* ===== 视图切换 ===== */
.view-switch .btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 6px rgba(79,70,229,.28);
}

/* ===== 思维导图视图 ===== */
.mm-search { width: 190px; }
.mm-wrap {
  position: relative; height: calc(100vh - 258px); min-height: 460px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background-color: #fbfcfe;
  background-image: radial-gradient(#e4eaf2 1px, transparent 1px);
  background-size: 22px 22px;
  cursor: grab;
}
.mm-wrap:focus, .mm-wrap:focus-visible { outline: none; }
.mm-wrap.panning { cursor: grabbing; }
.mm-wrap.dragging { cursor: move; }
.mm-svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.mm-svg text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  dominant-baseline: alphabetic;
}
.mm-node { cursor: pointer; }
.mm-node .mm-box { transition: stroke .12s, fill .12s; }
.mm-node:hover .mm-box { filter: drop-shadow(0 2px 5px rgba(15,23,42,.14)); }
.mm-node .mm-acts { opacity: 0; transition: opacity .12s; }
.mm-node:hover .mm-acts, .mm-node.sel .mm-acts { opacity: 1; }
.mm-act { cursor: pointer; }
.mm-act rect { transition: fill .1s, stroke .1s; }
.mm-act:hover rect { fill: var(--accent); stroke: var(--accent); }
.mm-act:hover text { fill: #fff; }
.mm-act.danger:hover rect { fill: #dc2626; stroke: #dc2626; }
.mm-fold { cursor: pointer; }
.mm-fold:hover circle { fill: #f1f5f9; }
.mm-node.dim { opacity: .26; }
.mm-node.mm-dragging { opacity: .42; }
.mm-node.drop .mm-box { stroke: #f59e0b; stroke-width: 2.4; stroke-dasharray: 7 4; }
.mm-strike { text-decoration: line-through; }

.mm-tools {
  position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px;
  box-shadow: 0 4px 14px rgba(15,23,42,.09); z-index: 7;
}
.mm-tools button {
  width: 26px; height: 26px; border: none; background: transparent; border-radius: 6px;
  color: #475569; font-size: 13px; line-height: 1; padding: 0;
}
.mm-tools button:hover { background: var(--accent-soft); color: var(--accent); }
.mm-zoom { font-size: 11.5px; color: var(--muted); min-width: 38px; text-align: center; }

.mm-hint {
  position: absolute; left: 188px; bottom: 17px; max-width: 48%;
  font-size: 11.5px; color: #94a3b8; background: rgba(255,255,255,.86);
  border-radius: 8px; padding: 4px 9px; pointer-events: none;
}
.mm-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; color: var(--muted);
}
.mm-empty .big { font-size: 34px; color: #cbd5e1; }

/* 聚焦模式：隐藏右侧详情，导图全宽 */
#taskRow.map-immersive #detailCol { display: none; }
#taskRow.map-immersive #treeCol { flex: 0 0 100%; max-width: 100%; }
#taskRow.map-immersive .mm-wrap { height: calc(100vh - 196px); }

body.tasks-fullscreen .sidebar { display: none !important; }
body.tasks-fullscreen .app-shell { grid-template-columns: 1fr !important; }
body.tasks-fullscreen .main { width: 100% !important; max-width: none !important; padding: 0 !important; }
body.tasks-fullscreen .page-head { display: none !important; }
body.tasks-fullscreen #taskRow { margin: 0 !important; }
body.tasks-fullscreen #treeCol { width: 100% !important; max-width: 100% !important; }
body.tasks-fullscreen #treeCol #treeCard { display: none !important; }
body.tasks-fullscreen #taskRow #detailCol { display: none !important; }
body.tasks-fullscreen #mapCard {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 20;
}
body.tasks-fullscreen #mapCard .card-header {
  border-bottom: 1px solid var(--line);
}
body.tasks-fullscreen #mapCard .card-body {
  height: calc(100vh - 58px) !important;
}
body.tasks-fullscreen #mapCard .mm-wrap {
  height: calc(100vh - 88px) !important;
}

#mapCard.map-fullscreen {
  border-radius: 0 !important;
}
#mapCard.map-fullscreen .card-body {
  height: calc(100vh - 160px) !important;
}
#mapCard.map-fullscreen .mm-wrap {
  height: calc(100vh - 190px) !important;
}

/* ===== 内容抽屉：在导图内直接浏览笔记 / 图片 / 资料 ===== */
.mm-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 392px; max-width: 100%;
  display: flex; flex-direction: column; z-index: 6;
  background: #fff; border-left: 1px solid var(--line);
  box-shadow: -10px 0 26px rgba(15,23,42,.10);
}
.mmd-head { position: relative; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.mmd-title { font-weight: 700; font-size: 14px; color: var(--ink); padding-right: 26px; }
.mmd-path { font-size: 11.5px; color: var(--muted); margin-top: 2px; padding-right: 26px; word-break: break-all; }
.mmd-close {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border: none;
  background: transparent; color: #94a3b8; font-size: 18px; line-height: 1; border-radius: 6px;
}
.mmd-close:hover { background: #f1f5f9; color: #334155; }
.mmd-ops { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mmd-tabs { display: flex; gap: 2px; padding: 4px 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mmd-tab {
  border: none; background: transparent; color: var(--muted); font-size: 12.5px;
  padding: 6px 9px; border-radius: 8px 8px 0 0;
}
.mmd-tab:hover { background: #f8fafc; color: var(--ink); }
.mmd-tab.active { color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.mmd-tab span { font-size: 10.5px; opacity: .85; }
.mmd-body { flex: 1; overflow: auto; padding: 10px 12px 18px; }

.mmd-sec { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; letter-spacing: .3px; }
.mmd-sec:first-child { margin-top: 0; }
.mmd-desc {
  font-size: 12px; color: #475569; line-height: 1.6; background: #f8fafc;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; margin-bottom: 10px;
  white-space: pre-line; word-break: break-word;
}
.mmd-none { font-size: 12.5px; color: var(--muted); padding: 10px 0; }

.mmd-img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mmd-img {
  position: relative; margin: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--line); background: #f8fafc; aspect-ratio: 1 / 1;
}
.mmd-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mmd-img figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10.5px; color: #fff;
  background: linear-gradient(transparent, rgba(15,23,42,.72)); padding: 12px 5px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mmd-img:hover { border-color: var(--accent); }

.mmd-note { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; background: #fff; }
.mmd-note:hover { border-color: #cbd5e1; }
.mmd-note-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mmd-note-title { font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; }
.mmd-note-title:hover { color: var(--accent); }
.mmd-note-time { font-size: 10.5px; color: var(--muted); margin-left: auto; }
.mmd-note-ex {
  font-size: 12.5px; color: #475569; line-height: 1.6; margin-top: 6px;
  white-space: pre-line; word-break: break-word;
}
.mmd-note-ex.full { max-height: 260px; overflow: auto; }
.mmd-note-imgs { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.mmd-note-imgs img {
  width: 54px; height: 54px; object-fit: cover; border-radius: 7px;
  border: 1px solid var(--line); cursor: zoom-in;
}
.mmd-note-ops { display: flex; gap: 10px; margin-top: 7px; }
.mmd-op {
  border: none; background: transparent; padding: 0; font-size: 11.5px;
  color: var(--accent); text-decoration: none; cursor: pointer;
}
.mmd-op:hover { text-decoration: underline; }
.mmd-op.danger { color: #dc2626; }

.mmd-file { display: flex; align-items: center; gap: 9px; padding: 7px 2px; border-bottom: 1px dashed var(--line); }
.mmd-file:last-child { border-bottom: none; }
.mmd-file-body { min-width: 0; flex: 1; }
.mmd-file-body a {
  font-size: 13px; color: var(--ink); text-decoration: none; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mmd-file-body a:hover { color: var(--accent); }
.mmd-file-meta { font-size: 11px; color: var(--muted); }
.mmd-file-ops { display: flex; gap: 9px; flex-shrink: 0; }

/* ===== 图片灯箱 ===== */
.mm-lightbox {
  position: fixed; inset: 0; z-index: 3000; background: rgba(15,23,42,.86);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
  padding: 40px 20px;
}
.mm-lightbox img { max-width: 94vw; max-height: 78vh; border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.mm-lightbox-bar { display: flex; align-items: center; gap: 10px; color: #e2e8f0; font-size: 12.5px; }
.mm-lightbox-name { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 991.98px) {
  .mm-search { width: 130px; }
  .mm-wrap { height: 62vh; }
  .mm-hint { display: none; }
  .mm-drawer { width: 100%; border-left: none; }
  .mmd-tabs { overflow-x: auto; }
}
