* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2329;
  background: #f5f6f8;
}

#app { display: flex; height: 100vh; }

/* Sidebar */
#sidebar {
  width: 300px;
  flex: 0 0 300px;
  background: #fff;
  border-right: 1px solid #e6e8eb;
  display: flex;
  flex-direction: column;
}
.side-head {
  padding: 16px;
  border-bottom: 1px solid #eef0f2;
}
.side-head h1 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
button {
  cursor: pointer;
  border: 1px solid #d0d4d9;
  background: #fff;
  color: #1f2329;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  transition: all .15s;
}
button:hover { border-color: #409eff; color: #409eff; }
button.primary { background: #409eff; border-color: #409eff; color: #fff; }
button.primary:hover { background: #66b1ff; border-color: #66b1ff; color: #fff; }
button.danger:hover { border-color: #f56c6c; color: #f56c6c; }
.side-head .primary { width: 100%; padding: 8px; }

.map-list { flex: 1; overflow-y: auto; padding: 8px; }
.empty { color: #9aa0a6; font-size: 13px; padding: 24px 12px; line-height: 1.6; }
.map-item {
  border: 1px solid #eef0f2;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafbfc;
  transition: all .15s;
}
.map-item:hover { border-color: #c8d6ea; }
.map-item.active { border-color: #409eff; background: #ecf5ff; }
.mi-main { cursor: pointer; }
.mi-name { font-size: 14px; font-weight: 500; word-break: break-all; }
.mi-meta { font-size: 12px; color: #9aa0a6; margin-top: 4px; }
.mi-acts { display: flex; gap: 6px; margin-top: 8px; }
.mi-acts button { padding: 3px 8px; font-size: 12px; }
.side-foot { padding: 12px 16px; border-top: 1px solid #eef0f2; font-size: 12px; color: #6b7178; }

/* Main */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 52px;
  flex: 0 0 52px;
  background: #fff;
  border-bottom: 1px solid #e6e8eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.doc-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.status { font-size: 12px; color: #9aa0a6; }

.mindmap { flex: 1; min-height: 0; position: relative; background: #fff; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 10px; width: 420px; max-width: 90vw; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { padding: 14px 16px; border-bottom: 1px solid #eef0f2; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.modal-head .x { border: none; background: transparent; font-size: 20px; line-height: 1; color: #9aa0a6; padding: 0 6px; }
.modal-body { padding: 8px; overflow-y: auto; }
.hist-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.hist-row button { padding: 3px 10px; font-size: 12px; }
